[Resolved] Custom Members Directory in a New Template
-
Hello,
How could I make a custom Members Directory in a new template with members that have chosen a specific value of an xprofile field?
Here is what I have done. I have created a new template members-loop-london.php (copy of members-loop.php) in the members folder and I would like to display there only members that have chosen at the xprofile field City the value London. Then according to this link about “bp_parse_args()” https://buddypress.trac.wordpress.org/browser/tags/2.2.1/src/bp-members/bp-members-template.php#L461 I added in the template the function:
function mine_bp_has_members( $args = '' ) { global $members_template; // Default user ID $user_id = 0; $r = bp_parse_args( $args, array( 'search_terms' => 'London', // Pass search_terms to filter users by their profile data ), 'has_members' ); // Pass a filter if ?s= is set. if ( is_null( $r['search_terms'] ) ) { if ( !empty( $_REQUEST['s'] ) ) { $r['search_terms'] = $_REQUEST['s']; } else { $r['search_terms'] = false; } } // Query for members and populate $members_template global $members_template = new BP_Core_Members_Template( $r['search_terms'], ); return apply_filters( 'mine_bp_has_members', $members_template->has_members(), $members_template ); }
but nothing changed. Still my custom directory was showing all the members of website..What am I doing wrong?
- The topic ‘[Resolved] Custom Members Directory in a New Template’ is closed to new replies.