I'm trying to get a list of members for a buddy press group but the result leaves out members that are admins or mods even though exclude_admins_mods=false has been specified as a parameter. This is what my code is

    global $bp;
    $id = 1;
    if (bp_group_has_members('group_id='.$id.'&exclude_admins_mods=false')) : 
        while ( bp_group_members() ) : bp_group_the_member(); 
             echo '<br>';

    else: ?>
      <div id="message" class="info">
        <p>no members.</p>
<?php endif; ?>

Have I missed anything obvious here?


You don't need this global $bp;

Try passing an array:

$id = 1;
$args = array( 'group_id' => $id, 'exclude_admins_mods' => false);
if ( bp_group_has_members( $args ) ) :
  • This worked. I was under the impression that the arguments had to be provided as a string. – Ronald Fernandes Feb 4 '16 at 3:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.