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 }
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 }