"><?php _e('email', 'pmpro'); ?> </a> </td> </tr> <?php } if (!$order_ids) { ?> <tr> <td colspan="9"><p><?php _e('No orders found.', 'pmpro'); ?> </p></td> </tr> <?php } ?> </tbody> </table> </form> <?php //add normal args $pagination_url = add_query_arg($url_params, get_admin_url(null, "/admin.php?page=pmpro-orders")); echo pmpro_getPaginationString($pn, $totalrows, $limit, 1, $pagination_url, "&limit={$limit}&pn="); ?> <?php } require_once dirname(__FILE__) . "/admin_footer.php";
<td align="center"> <a href="admin.php?page=pmpro-orders&order=-1©=<?php echo $order->id;?>">copy</a> </td> <td align="center"> <a href="javascript:askfirst('Deleting orders is permanent and can affect active users. Are you sure you want to delete order <?php echo str_replace("'", "", $order->code);?>?', 'admin.php?page=pmpro-orders&delete=<?php echo $order->id;?>'); void(0);">delete</a> </td> </tr> <?php } if(!$order_ids) { ?> <tr> <td colspan="9"><p>No orders found.</p></td> </tr> <?php } ?> </tbody> </table> </form> <?php echo pmpro_getPaginationString($pn, $totalrows, $limit, 1, get_admin_url(NULL, "/admin.php?page=pmpro-orders&s=" . urlencode($s)), "&l=$l&limit=$limit&pn="); ?> <?php } ?> </div>
function pmpro_report_login_page() { global $wpdb; $now = current_time('timestamp'); //vars if (!empty($_REQUEST['s'])) { $s = $_REQUEST['s']; } else { $s = ""; } if (!empty($_REQUEST['l'])) { $l = intval($_REQUEST['l']); } else { $l = ""; } ?> <form id="posts-filter" method="get" action=""> <h2> <?php _e('Visits, Views, and Logins Report', 'pmpro'); ?> </h2> <ul class="subsubsub"> <li> <?php _ex('Show', 'Dropdown label, e.g. Show All Users', 'pmpro'); ?> <select name="l" onchange="jQuery('#posts-filter').submit();"> <option value="" <?php if (!$l) { ?> selected="selected"<?php } ?> ><?php _e('All Users', 'pmpro'); ?> </option> <option value="all" <?php if ($l == "all") { ?> selected="selected"<?php } ?> ><?php _e('All Levels', 'pmpro'); ?> </option> <?php $levels = $wpdb->get_results("SELECT id, name FROM {$wpdb->pmpro_membership_levels} ORDER BY name"); foreach ($levels as $level) { ?> <option value="<?php echo $level->id; ?> " <?php if ($l == $level->id) { ?> selected="selected"<?php } ?> ><?php echo $level->name; ?> </option> <?php } ?> </select> </li> </ul> <p class="search-box"> <label class="hidden" for="post-search-input"><?php _ex('Search', 'Search form label', 'pmpro'); ?> <?php if (empty($l)) { echo "Users"; } else { echo "Members"; } ?> :</label> <input type="hidden" name="page" value="pmpro-reports" /> <input type="hidden" name="report" value="login" /> <input id="post-search-input" type="text" value="<?php echo esc_attr($s); ?> " name="s"/> <input class="button" type="submit" value="Search Members"/> </p> <?php //some vars for the search if (isset($_REQUEST['pn'])) { $pn = intval($_REQUEST['pn']); } else { $pn = 1; } if (isset($_REQUEST['limit'])) { $limit = intval($_REQUEST['limit']); } else { $limit = 15; } $end = $pn * $limit; $start = $end - $limit; if ($s) { $sqlQuery = "SELECT SQL_CALC_FOUND_ROWS u.ID, u.user_login, u.user_email, UNIX_TIMESTAMP(u.user_registered) as joindate, mu.membership_id, mu.initial_payment, mu.billing_amount, mu.cycle_period, mu.cycle_number, mu.billing_limit, mu.trial_amount, mu.trial_limit, UNIX_TIMESTAMP(mu.startdate) as startdate, UNIX_TIMESTAMP(mu.enddate) as enddate, m.name as membership FROM {$wpdb->users} u LEFT JOIN {$wpdb->usermeta} um ON u.ID = um.user_id LEFT JOIN {$wpdb->pmpro_memberships_users} mu ON u.ID = mu.user_id AND mu.status = 'active' LEFT JOIN {$wpdb->pmpro_membership_levels} m ON mu.membership_id = m.id WHERE (u.user_login LIKE '%" . esc_sql($s) . "%' OR u.user_email LIKE '%" . esc_sql($s) . "%' OR um.meta_value LIKE '%" . esc_sql($s) . "%') "; if ($l == "all") { $sqlQuery .= " AND mu.status = 'active' AND mu.membership_id > 0 "; } elseif ($l) { $sqlQuery .= " AND mu.membership_id = '" . $l . "' "; } $sqlQuery .= "GROUP BY u.ID ORDER BY user_registered DESC LIMIT {$start}, {$limit}"; } else { $sqlQuery = "SELECT SQL_CALC_FOUND_ROWS u.ID, u.user_login, u.user_email, UNIX_TIMESTAMP(u.user_registered) as joindate, mu.membership_id, mu.initial_payment, mu.billing_amount, mu.cycle_period, mu.cycle_number, mu.billing_limit, mu.trial_amount, mu.trial_limit, UNIX_TIMESTAMP(mu.startdate) as startdate, UNIX_TIMESTAMP(mu.enddate) as enddate, m.name as membership FROM {$wpdb->users} u LEFT JOIN {$wpdb->pmpro_memberships_users} mu ON u.ID = mu.user_id AND mu.status = 'active' LEFT JOIN {$wpdb->pmpro_membership_levels} m ON mu.membership_id = m.id"; $sqlQuery .= " WHERE 1=1 "; if ($l == "all") { $sqlQuery .= " AND mu.membership_id > 0 AND mu.status = 'active' "; } elseif ($l) { $sqlQuery .= " AND mu.membership_id = '" . $l . "' "; } $sqlQuery .= "GROUP BY u.ID ORDER BY user_registered DESC LIMIT {$start}, {$limit}"; } $sqlQuery = apply_filters("pmpro_members_list_sql", $sqlQuery); $theusers = $wpdb->get_results($sqlQuery); $totalrows = $wpdb->get_var("SELECT FOUND_ROWS() as found_rows"); if ($theusers) { ?> <p class="clear"><?php echo strval($totalrows); ?> <?php if (empty($l)) { echo "users"; } else { echo "members"; } ?> found. <?php } ?> <table class="widefat"> <thead> <tr class="thead"> <th><?php _e('ID', 'pmpro'); ?> </th> <th><?php _e('User', 'pmpro'); ?> </th> <th><?php _e('Name', 'pmpro'); ?> </th> <th><?php _e('Membership', 'pmpro'); ?> </th> <th><?php _e('Joined', 'pmpro'); ?> </th> <th><?php _e('Expires', 'pmpro'); ?> </th> <th><?php _e('Last Visit', 'pmpro'); ?> </th> <th><?php _e('Visits This Month', 'pmpro'); ?> </th> <th><?php _e('Total Visits', 'pmpro'); ?> </th> <th><?php _e('Views This Month', 'pmpro'); ?> </th> <th><?php _e('Total Views', 'pmpro'); ?> </th> <th><?php _e('Last Login', 'pmpro'); ?> </th> <th><?php _e('Logins This Month', 'pmpro'); ?> </th> <th><?php _e('Total Logins', 'pmpro'); ?> </th> </tr> </thead> <tbody id="users" class="list:user user-list"> <?php $count = 0; foreach ($theusers as $auser) { //get meta $theuser = get_userdata($auser->ID); $visits = get_user_meta($auser->ID, "pmpro_visits", true); $views = get_user_meta($auser->ID, "pmpro_views", true); $logins = get_user_meta($auser->ID, "pmpro_logins", true); if (empty($logins)) { $logins = array("last" => "N/A", "month" => "N/A", "alltime" => "N/A"); } ?> <tr <?php if ($count++ % 2 == 0) { ?> class="alternate"<?php } ?> > <td><?php echo $theuser->ID; ?> </td> <td> <?php echo get_avatar($theuser->ID, 32); ?> <strong> <?php $userlink = '<a href="user-edit.php?user_id=' . $theuser->ID . '">' . $theuser->user_login . '</a>'; $userlink = apply_filters("pmpro_members_list_user_link", $userlink, $theuser); echo $userlink; ?> </strong> </td> <td> <?php echo $theuser->display_name; ?> </td> <td><?php echo $auser->membership; ?> </td> <td><?php echo date("m/d/Y", strtotime($theuser->user_registered, current_time("timestamp"))); ?> </td> <td> <?php if ($auser->enddate) { echo date(get_option('date_format'), $auser->enddate); } else { echo "Never"; } ?> </td> <td><?php if (!empty($visits['last'])) { echo $visits['last']; } ?> </td> <td><?php if (!empty($visits['month']) && pmpro_isDateThisMonth($visits['last'])) { echo $visits['month']; } ?> </td> <td><?php if (!empty($visits['alltime'])) { echo $visits['alltime']; } ?> </td> <td><?php if (!empty($views['month']) && pmpro_isDateThisMonth($views['last'])) { echo $views['month']; } ?> </td> <td><?php if (!empty($views['alltime'])) { echo $views['alltime']; } ?> </td> <td><?php if (!empty($logins['last'])) { echo $logins['last']; } ?> </td> <td><?php if (!empty($logins['month']) && pmpro_isDateThisMonth($logins['last'])) { echo $logins['month']; } ?> </td> <td><?php if (!empty($logins['alltime'])) { echo $logins['alltime']; } ?> </td> </tr> <?php } if (!$theusers) { ?> <tr> <td colspan="9"><p><?php _e('No members found.', 'pmpro'); ?> <?php if ($l) { ?> <a href="?page=pmpro-memberslist&s=<?php echo esc_attr($s); ?> "><?php _e('Search all levels', 'pmpro'); ?> </a>.<?php } ?> </p></td> </tr> <?php } ?> </tbody> </table> </form> <?php echo pmpro_getPaginationString($pn, $totalrows, $limit, 1, get_admin_url(NULL, "/admin.php?page=pmpro-reports&report=login&s=" . urlencode($s)), "&l={$l}&limit={$limit}&pn="); }
<tr> <td colspan="9"><p><?php _e("No members found.", "pmpro"); ?> <?php if ($l) { ?> <a href="?page=pmpro-memberslist&s=<?php echo esc_attr($s); ?> "><?php _e("Search all levels", "pmpro"); ?> </a>.<?php } ?> </p></td> </tr> <?php } ?> </tbody> </table> </form> <?php echo pmpro_getPaginationString($pn, $totalrows, $limit, 1, add_query_arg(array("s" => urlencode($s), "l" => $l, "limit" => $limit))); ?> <?php require_once dirname(__FILE__) . "/admin_footer.php";
<td colspan="9"><p><?php _e("No members found.", "pmpro"); ?> <?php if ($l) { ?> <a href="?page=pmpro-memberslist&s=<?php echo $s; ?> "><?php _e("Search all levels", "pmpro"); ?> </a>.<?php } ?> </p></td> </tr> <?php } ?> </tbody> </table> </form> <?php echo pmpro_getPaginationString($pn, $totalrows, $limit, 1, get_admin_url(NULL, "/admin.php?page=pmpro-memberslist&s=" . urlencode($s)), "&l={$l}&limit={$limit}&pn="); ?> <?php require_once dirname(__FILE__) . "/admin_footer.php";