Skip to:
Content
Pages
Categories
Search
Top
Bottom

Display Group Mod Member Type


  • justingut
    Participant

    @justingut

    I apologize if this is something fairly easy but I’m a bit of a beginner when it comes to this stuff. I’m looking to display my Group Mod’s member types above their names on the group page I have created but all I can get is the id to show up which of course is not user friendly when it comes to reading it. I have pasted the code I have below if anyone could please help me with this. Thank You!

    function bp_group_list_mods( $group = false ) {
    	global $groups_template;
    
    	if ( empty( $group ) ) {
    		$group =& $groups_template->group;
    	}
    
    	if ( ! empty( $group->mods ) ) : ?>
    
    		<ul id="group-mods">
    
    			<?php foreach( (array) $group->mods as $mod ) { ?>
    
    				<li id="groupmods-list"><div class="item-avatar">
    					<a href="<?php echo bp_core_get_user_domain( $mod->user_id, $mod->user_nicename, $mod->user_login ) ?>" class="bp-tooltip" data-bp-tooltip="<?php printf( ('%s'),  bp_core_get_user_displayname( $mod->user_id ) ); ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $mod->user_id, 'email' => $mod->user_email, 'alt' => sprintf( __( 'Profile picture of %s', 'buddypress' ) ) ) ) ?></a></div>
    				<div class="item">
    				<div class="groupmod-type"><p><?php printf( ('%s'),  bp_get_member_type( $mod->user_id) );  ?></p></div>
    				<div class="groupmod-name"><p><?php printf( ('%s'),  bp_core_get_user_displayname( $mod->user_id ) );  ?><p></div>
    
    			</div>
    				</li>
    
    			<?php } ?>
    
    		</ul>
Viewing 1 replies (of 1 total)

  • shanebp
    Moderator

    @shanebp

    Your code is incomplete and does not appear to be germane to displaying member types.
    Perhaps you meant to post something else.

    Anyhow –
    You can use groups_get_group_mods( $group_id ) to get an array re the mods that includes their IDs.

    Then use bp_get_member_type( $user_id ) to get the member type.

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