Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Adding Member Directory sub-directories using $bp->current_action?


John James Jacoby
Keymaster

@johnjamesjacoby

The reason the type wasn’t passing in the ajax was because it wasn’t saved anywhere in the loop form… You could try replacing the “bp_the_site_member_hidden_fields” function with this in bp-custom.php, then calling this function in members-loop.php in its place…

function bp_custom_the_site_member_hidden_fields() {
if ( isset( $_REQUEST['s'] ) ) {
echo '<input type="hidden" id="search_terms" value="' . attribute_escape( $_REQUEST['s'] ) . '" name="search_terms" />';
}

if ( isset( $_REQUEST['letter'] ) ) {
echo '<input type="hidden" id="selected_letter" value="' . attribute_escape( $_REQUEST['letter'] ) . '" name="selected_letter" />';
}

if ( isset( $_REQUEST['members_search'] ) ) {
echo '<input type="hidden" id="search_terms" value="' . attribute_escape( $_REQUEST['members_search'] ) . '" name="search_terms" />';
}

if ( isset( $_REQUEST['type'] ) ) {
echo '<input type="hidden" id="type" value="' . attribute_escape( $_REQUEST['type'] ) . '" name="type" />';
}
}

Then at the beginning of members-loop.php, replace…

<?php if ( bp_has_site_members( 'type=active&per_page=10' ) ) : ?>

…with something like…

<?php if ( bp_has_site_members( 'type=' . $_REQUEST['type'] . '&per_page=10' ) ) : ?>

…but keep in mind that it’s bad practice to refer to any variable directly in the template; you should probably build a function to wrap around it and sanitize it (although in this case nothing bad could really come out of it.)

See if something like this works?

Skip to toolbar