Filter list of profiles on Member Page
-
Hey guys, I’ve seen this asked here a few times in the past 4 years. But I haven’t seen any working solutions.
On my installation i’m using buddypress + s2member pro. So far it’s working together nicely. Except when I try to filter profile results on the /members page.
Honestly, these kinds of manipulations are usually so difficult for me, but for some reason I just can’t figure out what i’m doing wrong.
in my members-loop.php file here is a snippet of the code i’m using to try and filter the user results. It start directly under the while( bp_members() ) : bp_the_members();
<?php while ( bp_members() ) : bp_the_member(); ?>
<?php $user_id = bp_get_member_user_id();
$user = new WP_User( $user_id );
if ($user->roles[0] != 's2member_level2')
continue;
?>I have also tried this bit of code to get it to work:
<?php while ( bp_members() ) : bp_the_member(); ?>
<?php $user=bp_get_member_user_id();
$s2member_var = get_user_field ("s2member_access_role", $user);
if ($s2member_var == "s2member_level1" || $s2member_var == "administrator") {
?>
but still no results.
Using either one does not work, and the members page will still show all the users. I dont understand what i’m doing wrong!
Thanks so much in advanced for any advice.
Myg0t
- The topic ‘Filter list of profiles on Member Page’ is closed to new replies.