Skip to:
Content
Pages
Categories
Search
Top
Bottom

bp_has_members multiple params with array

  • @gsxrgeek

    Participant

    I am trying to sort the list alphabetically and only include an array of id’s. The if statement isn’t working properly. Not sure if the syntax is correct. Thanks for the help!

    if ( bp_has_members(array(‘include’ => $custom_ids) . ‘&type=alphabetical’)) :

Viewing 3 replies - 1 through 3 (of 3 total)
  • @shanebp

    Moderator

    You can’t pass an array of ids in that manner. Pass a csv string.
    For example, assuming $custom_ids is an array:

    $gsxrgeek = 'include=' . implode(",", $custom_ids);
    $gsxrgeek .= '&type=alphabetical';
    if ( bp_has_members( $gsxrgeek ) ) //etc

    More info.

    @gsxrgeek

    Participant

    Brilliant, thank you!

    @r-a-y

    Keymaster

    The problem is you were using an array with a string for the parameters. You can only use one or the other.

    shanebp outlines the string method.

    You can also use the array method:

    if ( bp_has_members( array( 'include' => $user_ids, 'type' => 'alphabetical' ) ) ) {

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘bp_has_members multiple params with array’ is closed to new replies.
Skip to toolbar