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 }
function invite_anyone_screen_two_content() { global $bp; // Load the pagination helper if (!class_exists('BBG_CPT_Pag')) { require_once BP_INVITE_ANYONE_DIR . 'lib/bbg-cpt-pag.php'; } $pagination = new BBG_CPT_Pag(); $inviter_id = bp_loggedin_user_id(); if (isset($_GET['sort_by'])) { $sort_by = $_GET['sort_by']; } else { $sort_by = 'date_invited'; } if (isset($_GET['order'])) { $order = $_GET['order']; } else { $order = 'DESC'; } $base_url = $bp->displayed_user->domain . $bp->invite_anyone->slug . '/sent-invites/'; ?> <h4><?php _e('Sent Invites', 'invite-anyone'); ?> </h4> <?php $invites = invite_anyone_get_invitations_by_inviter_id(bp_loggedin_user_id(), $sort_by, $order, $pagination->get_per_page, $pagination->get_paged); ?> <?php $pagination->setup_query($invites); ?> <?php if ($invites->have_posts()) { ?> <p id="sent-invites-intro"><?php _e('You have sent invitations to the following people.', 'invite-anyone'); ?> </p> <div class="ia-pagination"> <div class="currently-viewing"> <?php $pagination->currently_viewing_text(); ?> </div> <div class="pag-links"> <?php $pagination->paginate_links(); ?> </div> </div> <table class="invite-anyone-sent-invites zebra" summary="<?php _e('This table displays a list of all your sent invites. Invites that have been accepted are highlighted in the listings. You may clear any individual invites, all accepted invites or all of the invites from the list.', 'invite-anyone'); ?> "> <thead> <tr> <th scope="col"></th> <th scope="col" <?php if ($sort_by == 'email') { ?> class="sort-by-me"<?php } ?> ><a class="<?php echo $order; ?> " title="Sort column order <?php echo $order; ?> " href="<?php echo $base_url; ?> ?sort_by=email&order=<?php if ($sort_by == 'email' && $order == 'ASC') { ?> DESC<?php } else { ?> ASC<?php } ?> "><?php _e('Invited email address', 'invite-anyone'); ?> </a></th> <th scope="col"><?php _e('Group invitations', 'invite-anyone'); ?> </th> <th scope="col" <?php if ($sort_by == 'date_invited') { ?> class="sort-by-me"<?php } ?> ><a class="<?php echo $order; ?> " title="Sort column order <?php echo $order; ?> " href="<?php echo $base_url; ?> ?sort_by=date_invited&order=<?php if ($sort_by == 'date_invited' && $order == 'DESC') { ?> ASC<?php } else { ?> DESC<?php } ?> "><?php _e('Sent', 'invite-anyone'); ?> </a></th> <th scope="col" <?php if ($sort_by == 'date_joined') { ?> class="sort-by-me"<?php } ?> ><a class="<?php echo $order; ?> " title="Sort column order <?php echo $order; ?> " href="<?php echo $base_url; ?> ?sort_by=date_joined&order=<?php if ($order == 'DESC') { ?> ASC<?php } else { ?> DESC<?php } ?> "><?php _e('Accepted', 'invite-anyone'); ?> </a></th> </tr> </thead> <tfoot> <tr id="batch-clear"> <td colspan="5" > <ul id="invite-anyone-clear-links"> <li> <a title="<?php _e('Clear all accepted invites from the list', 'invite-anyone'); ?> " class="confirm" href="<?php echo wp_nonce_url($base_url . '?clear=accepted', 'invite_anyone_clear'); ?> "><?php _e('Clear all accepted invitations', 'invite-anyone'); ?> </a></li> <li class="last"><a title="<?php _e('Clear all your listed invites', 'invite-anyone'); ?> " class="confirm" href="<?php echo wp_nonce_url($base_url . '?clear=all', 'invite_anyone_clear'); ?> "><?php _e('Clear all invitations', 'invite-anyone'); ?> </a></li> </ul> </td> </tr> </tfoot> <tbody> <?php while ($invites->have_posts()) { $invites->the_post(); ?> <?php $emails = wp_get_post_terms(get_the_ID(), invite_anyone_get_invitee_tax_name()); // Should never happen, but was messing up my test env if (empty($emails)) { continue; } // Before storing taxonomy terms in the db, we replaced "+" with ".PLUSSIGN.", so we need to reverse that before displaying the email address. $email = str_replace('.PLUSSIGN.', '+', $emails[0]->name); $post_id = get_the_ID(); $query_string = preg_replace("|clear=[0-9]+|", '', $_SERVER['QUERY_STRING']); $clear_url = $query_string ? $base_url . '?' . $query_string . '&clear=' . $post_id : $base_url . '?clear=' . $post_id; $clear_url = wp_nonce_url($clear_url, 'invite_anyone_clear'); $clear_link = '<a class="clear-entry confirm" title="' . __('Clear this invitation', 'invite-anyone') . '" href="' . $clear_url . '">x<span></span></a>'; $groups = wp_get_post_terms(get_the_ID(), invite_anyone_get_invited_groups_tax_name()); if (!empty($groups)) { $group_names = '<ul>'; foreach ($groups as $group_term) { $group = new BP_Groups_Group($group_term->name); $group_names .= '<li>' . bp_get_group_name($group) . '</li>'; } $group_names .= '</ul>'; } else { $group_names = '-'; } global $post; $date_invited = invite_anyone_format_date($post->post_date); $accepted = get_post_meta(get_the_ID(), 'bp_ia_accepted', true); if ($accepted) { $date_joined = invite_anyone_format_date($accepted); $accepted = true; } else { $date_joined = '-'; $accepted = false; } ?> <tr <?php if ($accepted) { ?> class="accepted" <?php } ?> > <td><?php echo $clear_link; ?> </td> <td><?php echo esc_html($email); ?> </td> <td><?php echo $group_names; ?> </td> <td><?php echo $date_invited; ?> </td> <td class="date-joined"><span></span><?php echo $date_joined; ?> </td> </tr> <?php } ?> </tbody> </table> <div class="ia-pagination"> <div class="currently-viewing"> <?php $pagination->currently_viewing_text(); ?> </div> <div class="pag-links"> <?php $pagination->paginate_links(); ?> </div> </div> <?php } else { ?> <p id="sent-invites-intro"><?php _e("You haven't sent any email invitations yet.", 'invite-anyone'); ?> </p> <?php } ?> <?php }
/** * 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'); ?> </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> <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> <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 }