Created
February 13, 2016 19:20
-
-
Save eighty20results/4977ba1f0fee3d522428 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: PMPro Directory Customization | |
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/ | |
Description: Show all PMPro Users in directory (regardless of status). | |
Version: .1 | |
Author: Thomas Sjolshagen @ Stranger Studios <thomas@eighty20results.com> | |
Author URI: http://www.strangerstudios.com | |
*/ | |
if (!function_exists('my_ts_pmpro_member_directory_sql')) | |
{ | |
function my_ts_pmpro_member_directory_sql( $sql, $levels, $s, $pn, $limit, $start, $end, $order_by, $order ) | |
{ | |
$sql = preg_replace("/(mu.status\s*=\s*'active')/", "mu.status LIKE '%'", $sql); | |
$sql = preg_replace("/(ORDER BY\s(\w*\.\w*)\s*(ASC|DESC))/", "GROUP BY u.ID ORDER BY $2 $3", $sql); | |
$sql = preg_replace("/(LIMIT\s*\d{1,},\s*\d{1,})/", "$1", $sql); | |
return $sql; | |
} | |
} | |
add_filter('pmpro_member_directory_sql', 'my_ts_pmpro_member_directory_sql', 10, 9); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Don't limit the content of the user directory for PMPro to only users who're currently active members. Includes "everybody" who's ever been a member or has been assigned a membership level at some point.