Example #1
0
function invite_anyone_settings_mi_content()
{
    // Load the pagination helper
    if (!class_exists('BBG_CPT_Pag')) {
        require_once dirname(__FILE__) . '/../lib/bbg-cpt-pag.php';
    }
    $pagination = new BBG_CPT_Pag();
    // Load the sortable helper
    if (!class_exists('BBG_CPT_Sort')) {
        require_once dirname(__FILE__) . '/../lib/bbg-cpt-sort.php';
    }
    $cols = array(array('name' => 'author', 'title' => __('Inviter', 'invite-anyone'), 'css_class' => 'ia-inviter'), array('name' => 'ia_invitees', 'title' => __('Invited Email', 'invite-anyone'), 'css_class' => 'ia-invited-email'), array('name' => 'sent', 'title' => __('Sent', 'invite-anyone'), 'css_class' => 'ia-sent', 'default_order' => 'desc', 'posts_column' => 'post_date', 'is_default' => true), array('name' => 'accepted', 'title' => __('Accepted', 'invite-anyone'), 'css_class' => 'ia-accepted', 'default_order' => 'desc'), array('name' => 'cloudsponge', 'title' => __('CloudSponge', 'invite-anyone'), 'css_class' => 'ia-cloudsponge'));
    $sortable = new BBG_CPT_Sort($cols);
    $args = array('orderby' => $sortable->get_orderby, 'order' => $sortable->get_order, 'posts_per_page' => $pagination->get_per_page, 'paged' => $pagination->get_paged, 'status' => 'trash,publish,pending,draft,future');
    // Get the invites
    $invite = new Invite_Anyone_Invitation();
    $invites = $invite->get($args);
    // Complete the pagination setup
    $pagination->setup_query($invites);
    ?>

	<?php 
    if ($invites->have_posts()) {
        ?>
		<div class="ia-admin-pagination">
			<div class="currently-viewing">
				<?php 
        $pagination->currently_viewing_text();
        ?>
			</div>

			<div class="pag-links">
				<?php 
        $pagination->paginate_links();
        ?>
			</div>
		</div>

		<table class="wp-list-table widefat ia-invite-list">

		<thead>
			<tr>
				<th scope="col" id="cb" class="check-column">
					<input type="checkbox" />
				</th>

				<?php 
        if ($sortable->have_columns()) {
            while ($sortable->have_columns()) {
                $sortable->the_column();
                ?>
					<?php 
                $sortable->the_column_th();
                ?>
				<?php 
            }
        }
        ?>

			</tr>
		</thead>

		<tbody>
			<?php 
        while ($invites->have_posts()) {
            $invites->the_post();
            ?>
			<tr>
				<th scope="row" class="check-column">
					<input type="checkbox" />
				</th>

				<td class="ia-inviter">
					<?php 
            echo bp_core_get_userlink(get_the_author_ID());
            ?>

					<div class="row-actions">
						<span class="edit"><a href="<?php 
            echo add_query_arg(array('post' => get_the_ID(), 'action' => 'edit'), admin_url('post.php'));
            ?>
"><?php 
            _e('View Invitation', 'invite-anyone');
            ?>
</a></span>
					</div>
				</td>

				<td class="ia-invited-email">
					<?php 
            $emails = wp_get_post_terms(get_the_ID(), invite_anyone_get_invitee_tax_name());
            foreach ($emails as $email) {
                // Before storing taxonomy terms in the db, we replace "+" with ".PLUSSIGN.", so we need to reverse that before displaying the email address.
                $email_address = str_replace('.PLUSSIGN.', '+', $email->name);
                echo esc_html($email_address);
            }
            ?>
				</td>

				<td class="ia-sent">
					<?php 
            global $post;
            $date_invited = invite_anyone_format_date($post->post_date);
            ?>
					<?php 
            echo esc_html($date_invited);
            ?>
				</td>

				<td class="ia-accepted">
					<?php 
            if ($accepted = get_post_meta(get_the_ID(), 'bp_ia_accepted', true)) {
                $date_joined = invite_anyone_format_date($accepted);
                $accepted = true;
            } else {
                $date_joined = '-';
                $accepted = false;
            }
            ?>
					<?php 
            echo esc_html($date_joined);
            ?>
				</td>

				<td class="ia-cloudsponge">
					<?php 
            $is_cloudsponge = get_post_meta(get_the_ID(), 'bp_ia_is_cloudsponge', true);
            if (!$is_cloudsponge) {
                $is_cloudsponge = __('(no data)', 'invite-anyone');
            }
            ?>
					<?php 
            echo esc_html($is_cloudsponge);
            ?>
				</td>
			</tr>
			<?php 
        }
        ?>
		</tbody>
		</table>

		<?php 
        if (defined('INVITE_ANYONE_CS_ENABLED') && INVITE_ANYONE_CS_ENABLED) {
            ?>
			<p class="description"><strong>Note:</strong> CloudSponge data has only been recorded since Invite Anyone v0.9.</p>
		<?php 
        }
        ?>

		<div class="ia-admin-pagination">
			<div class="currently-viewing">
				<?php 
        $pagination->currently_viewing_text();
        ?>
			</div>

			<div class="pag-links">
				<?php 
        $pagination->paginate_links();
        ?>
			</div>
		</div>

	<?php 
    } else {
        ?>
		<p><?php 
        _e('No invitations have been sent yet.', 'invite-anyone');
        ?>
</p>

	<?php 
    }
    ?>

	<?php 
}
Example #2
0
    /**
     * Renders the main Unconfirmed Dashboard panel
     *
     * @package Unconfirmed
     * @since 1.0
     *
     * @uses BBG_CPT_Pag aka Boone's Pagination
     * @uses BBG_CPT_Sort aka Boone's Sortable Columns
     * @uses BBG_Unconfirmed::setup_users() to get a list of unactivated users
     */
    function admin_panel_main()
    {
        if (!class_exists('BBG_CPT_Pag')) {
            require_once dirname(__FILE__) . '/lib/boones-pagination.php';
        }
        $pagination = new BBG_CPT_Pag();
        // Load the sortable helper
        if (!class_exists('BBG_CPT_Sort')) {
            require_once dirname(__FILE__) . '/lib/boones-sortable-columns.php';
        }
        $cols = array(array('name' => 'user_login', 'title' => __('User Login', 'unconfirmed'), 'css_class' => 'login'), array('name' => 'user_email', 'title' => __('Email Address', 'unconfirmed'), 'css_class' => 'email'), array('name' => 'registered', 'title' => 'Registered', 'css_class' => 'registered', 'default_order' => 'desc', 'is_default' => true), array('name' => 'activation_key', 'title' => __('Activation Key', 'unconfirmed'), 'css_class' => 'activation-key'), array('name' => 'resent_count', 'title' => __('# of Times Resent', 'unconfirmed'), 'css_class' => 'resent-count', 'default_order' => 'desc', 'is_sortable' => false));
        // On non-multisite installations, we have the display name available. Show it.
        if (!$this->is_multisite) {
            $non_ms_cols = array(array('name' => 'display_name', 'title' => __('Display Name', 'unconfirmed')));
            // Can't get array_splice to work right for this multi-d array, so I'm
            // hacking around it
            $col0 = array($cols[0]);
            $cols_rest = array_slice($cols, 1);
            $cols = array_merge($col0, $non_ms_cols, $cols_rest);
        }
        $sortable = new BBG_CPT_Sort($cols);
        $offset = $pagination->get_per_page * ($pagination->get_paged - 1);
        $args = array('orderby' => $sortable->get_orderby, 'order' => $sortable->get_order, 'number' => $pagination->get_per_page, 'offset' => $offset);
        $this->setup_users($args);
        // Setting this up a certain way to make pagination/sorting easier
        $query = new stdClass();
        $query->users = $this->users;
        // In order for Boone's Pagination to work, this stuff must be set manually
        $query->found_posts = $this->total_users;
        $query->max_num_pages = ceil($query->found_posts / $pagination->get_per_page);
        // Complete the pagination setup
        $pagination->setup_query($query);
        ?>
		<div class="wrap">

		<h2><?php 
        _e('Unconfirmed', 'unconfirmed');
        ?>
</h2>

		<?php 
        $this->render_messages();
        ?>

		<form action="<?php 
        echo $this->base_url;
        ?>
" method="post">

		<p class="search-box">
			<label class="screen-reader-text" for="unconfirmed-search-input">Search:</label>
			<input type="search" id="unconfirmed-search-input" name="s" value="<?php 
        if (!empty($_REQUEST['s'])) {
            echo esc_attr($_REQUEST['s']);
        }
        ?>
">
			<input type="hidden" id="unconfirmed-performed-search-input" name="performed_search" value="0">
			<input type="submit" name="search_submit" id="search-submit" class="button" value="Search" onclick="document.getElementById('unconfirmed-performed-search-input').value = '1';">
		</p>

		<?php 
        if (!empty($this->users)) {
            ?>
			<div class="tablenav top">
				<div class="alignleft actions">
					<select name="unconfirmed_action">
						<option value="resend"><?php 
            _e('Resend Activation Email', 'unconfirmed');
            ?>
&nbsp;&nbsp;</option>
						<option value="activate"><?php 
            _e('Activate', 'unconfirmed');
            ?>
</option>
						<option value="delete"><?php 
            _e('Delete', 'unconfirmed');
            ?>
</option>
					</select>

					<input id="doaction" class="button-secondary action" type="submit" value="<?php 
            _e('Apply', 'unconfirmed');
            ?>
" />
					<input type="hidden" name="unconfirmed_bulk" value="1" />

					<?php 
            wp_nonce_field('unconfirmed_bulk_action');
            ?>
				</div>

				<div class="tablenav-pages unconfirmed-pagination">
					<div class="currently-viewing alignleft">
						<?php 
            $pagination->currently_viewing_text();
            ?>
					</div>

					<div class="pag-links alignright">
						<?php 
            $pagination->paginate_links();
            ?>
					</div>
				</div>
			</div>

			<table class="wp-list-table widefat ia-invite-list">

			<thead>
				<tr>
					<th scope="col" id="cb" class="check-column">
						<input type="checkbox" />
					</th>

					<?php 
            if ($sortable->have_columns()) {
                while ($sortable->have_columns()) {
                    $sortable->the_column();
                    ?>
						<?php 
                    $sortable->the_column_th();
                    ?>
					<?php 
                }
            }
            ?>

				</tr>
			</thead>

			<tbody>
				<?php 
            foreach ($this->users as $user) {
                ?>
				<tr>
					<th scope="row" class="check-column">
						<input type="checkbox" name="unconfirmed_key[]" value="<?php 
                echo $user->activation_key;
                ?>
" />
					</th>

					<td class="login">
						<?php 
                echo $user->user_login;
                ?>

						<div class="row-actions">
							<span class="edit"><a class="confirm" href="<?php 
                echo wp_nonce_url(add_query_arg(array('unconfirmed_action' => 'resend', 'unconfirmed_key' => $user->activation_key), $this->base_url), 'unconfirmed_resend_email');
                ?>
"><?php 
                _e('Resend Activation Email', 'unconfirmed');
                ?>
</a></span>

							&nbsp;&nbsp;
							<span class="edit"><a class="confirm" href="<?php 
                echo wp_nonce_url(add_query_arg(array('unconfirmed_action' => 'activate', 'unconfirmed_key' => $user->activation_key), $this->base_url), 'unconfirmed_activate_user');
                ?>
"><?php 
                _e('Activate', 'unconfirmed');
                ?>
</a></span>

							&nbsp;&nbsp;
							<span class="delete"><a title="<?php 
                _e('Deleting a registration means that it will be removed from the database, and the user will be unable to activate his account. Proceed with caution!', 'unconfirmed');
                ?>
" class="confirm" href="<?php 
                echo wp_nonce_url(add_query_arg(array('unconfirmed_action' => 'delete', 'unconfirmed_key' => $user->activation_key), $this->base_url), 'unconfirmed_delete_user');
                ?>
"><?php 
                _e('Delete', 'unconfirmed');
                ?>
</a></span>

						</div>
					</td>

					<?php 
                if (!$this->is_multisite) {
                    ?>
						<td class="display_name">
							<?php 
                    echo $user->display_name;
                    ?>
						</td>
					<?php 
                }
                ?>

					<td class="email">
						<?php 
                echo $user->user_email;
                ?>
					</td>

					<td class="registered">
						<?php 
                echo $user->registered;
                ?>
					</td>

					<td class="activation_key">
						<?php 
                echo $user->activation_key;
                ?>
					</td>

					<td class="activation_key">
						<?php 
                echo (int) $user->resent_count;
                ?>
					</td>

				</tr>
				<?php 
            }
            ?>
			</tbody>
			</table>

			<div class="tablenav bottom">
				<div class="unconfirmed-pagination alignright tablenav-pages">
					<div class="currently-viewing alignleft">
						<?php 
            $pagination->currently_viewing_text();
            ?>
					</div>

					<div class="pag-links alignright">
						<?php 
            $pagination->paginate_links();
            ?>
					</div>
				</div>
			</div>

		<?php 
        } else {
            ?>

			<p><?php 
            _e('No unactivated members were found.', 'unconfirmed');
            ?>
</p>

		<?php 
        }
        ?>

		</form>

		</div>
		<?php 
    }