I've installed Pro site, for my users to showcase their

Hey

I've installed Pro site, for my users to showcase their portfolios.!

I need to display all my members on a 'show members' page, but not in a link list. I need them to be displayed in images, like for example show their profile image og just a snippet image of their site..

Hope you understand :slight_smile:

Best Regards
Sille

  • Predrag Dubajic

    Hey Sille,

    Hope you're doing well today :slight_smile:

    There is no option withing Pro Sites to do this but based on my colleague Ash's code from this thread:
    https://premium.wpmudev.org/forums/topic/is-there-a-list-built-into-pro-sites-that-can-list-current-pro-site-paid-members-and-a-link-too

    This should work for you and show admin avatars:

    function show_pro_sites_func( $atts ) {
        global $psts;
        $sites = wp_get_sites( array( 'limit' => 5000 ) );
    
        $html .= '<table width="100%" cellspacing="0" cellpadding="0">';
        $html .= '<tr>';
        $html .= '<th>Avatar</th>';
    	$html .= '<th>Site Name</th>';
    	$html .= '<th>Admin</th>';
    	$html .= '<th>Pro Level</th>';
        $html .= '</tr>';
    
        foreach( $sites as $site ) {
        	if( $site['blog_id'] == 1 ) continue;
    	switch_to_blog( $site['blog_id'] );
    	$html .= '<tr>';
    	$html .= '<td>' . get_avatar(get_bloginfo( 'admin_email' )) . '</td>';
    	$html .= '<td><a href="' . site_url() . '" target="_blank">' . get_bloginfo( 'name' ) . '</a></td>';
    	$user = get_user_by( 'email', get_bloginfo( 'admin_email' ) );
    	$html .= '<td>' . $user->display_name . '</td>';
    	$html .= '<td>' . $psts->get_level_setting( $psts->get_level( $site['blog_id'] ), 'name' ) . '</td>';
    	$html .= '</tr>';
    	restore_current_blog();
        }
        $html .= '</table>';
        return $html;
    
    }
    add_shortcode( 'show_pro_sites', 'show_pro_sites_func' );

    After adding the code in your theme functions.php file or in mu-plugin just place this shortcode in any page and you should see the table:
    [show_pro_sites]

    Best regards,
    Predrag