BuddyPress: Output a second members loop for a customized list of UserIDs
-
I have a code / plugin which derivates a list of UserIDs by some logic which I want to display in a separate page in a sort of members loop.
I tried similarly to this code, setting the args and than loading the template, it simply does not display the members:
$members_args = array( 'include' => array(list of user ids here ... 1, 13, 25, 126, ...), 'exclude' => array(bp_loggedin_user_id()), 'per_page' => $max_members, 'max' => $max_members, 'populate_extras' => true, 'search_terms' => false, ); echo '<div id="buddypress" class="buddypress-wrap bp-dir-hori-nav bp-shortcode-wrap">'; echo '<div class="members">'; echo '<div class="subnav-filters filters no-ajax" id="subnav-filters">'; bp_get_template_part( 'common/filters/grid-filters' ); echo '</div>'; echo '<div class="screen-content members-directory-content">'; echo '<div id="members-dir-list" class="members dir-list">'; buddypress()->current_member_type = "my separate loop"; buddypress()->current_component = 'members'; buddypress()->is_directory = true; // Get a BuddyPress members-loop template part for display in a theme. bp_get_template_part( 'members/members-loop' ); echo '</div>'; echo '</div>'; echo '</div>';
I also tried instead to modify the query args like so instead of setting $members_args, but this does not work neither:
$include = array(1, 13, 25, 126, ...); # list of user IDs to show add_filter ('bp_ajax_querystring', 'modify_directory', 20, 2); function modify_directory ($query_string, $object) { if ($object != 'members') return $query_string; if (!empty ($query_string)) $query_string .= '&'; $query_string .= 'include='. implode(',', $include).'&exclude='.bp_loggedin_user_id(); return $query_string; }
Any idea?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.