Skip to:
Content
Pages
Categories
Search
Top
Bottom

display groups members list (in all groups)


  • diegomiguel05
    Participant

    @diegomiguel05

    Hello, I’d like to ask some help, please.

    I need that any user of my site could access the others groups home pages (even others private groups which the user don’t belong to) and access the members lists of any group. Does anybody know any hook or any other way?

    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)

  • shanebp
    Moderator

    @shanebp

    Where and when you place the data is up to you.
    To gather the data, try :

    $args = array(
    	 'show_hidden'   => true,
    	 'per_page'      => -1      
    );
    
    $groups = groups_get_groups( $args );
    
    foreach ( $groups['groups'] as $group ) {
    			
    	$args = array(
    		'group_id'   		=> $group->id,
    		'exclude_admins_mods'   => false      
    	);
    
    	$members = groups_get_group_members( $args ); 
    	
    	echo'<pre>'; var_dump( $members );  echo'</pre>'; // just for reference
    	
    	// do something with the member data
    }

    diegomiguel05
    Participant

    @diegomiguel05

    Hello shanebp, thank you very much for your response:

    We have realized that users could not access the home page of other private groups due to the inteference of another active plugin. Deactivating it, users already have access to the home page of others private groups, but still can not see the list of members of those groups. I’ve been trying to use your code (in function.php and writing it as html text), but it does not work, possibly I’m not writing it in the right place. Do you know how to solve this problem, please??

    Thank you very much for your help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar