• Resolved photospirit

    (@photospirit)


    Hi,
    I’m using the Ultimate Member Plugin and I want to show a list of members with the role “Editor”. I’ve done some PHP to get name and function (whereby function is a field) of the users with the role editor.

    <?php
    $args2 = array(
     'role' => 'editor',
     'meta_key' => 'rolle_sort',
     'orderby'  => 'meta_value',
     'order' => 'ASC'
    );
    
    $members = get_users($args2);
    echo '<table cellpadding="0" cellspacing="0">';
    foreach ($members as $user) {
    echo '<tr>';
    echo '<td>' . '<strong>' . $user->rolle . ':' .'</strong>' . '</td>';
    echo '<td>' . $user->first_name . ' ' .$user->last_name .'</td>';
    echo '<td>' . get_avatar(??????????? ), 50) .'</td>';
    echo '</tr>';
    }
    echo '</table>';
    ?>

    In addition to name and function I want also to show the avator of the according user.

    Any idea/help how to get the avatar of the role editor is highly appreciated.

    Thanks, Chris

    https://www.ads-software.com/plugins/ultimate-member/

Viewing 1 replies (of 1 total)
  • Thread Starter photospirit

    (@photospirit)

    after some more thinking and investigation I found a solution by using the profile_photo the user is uploading, when creating/editing the profile.

    So my code is as follows:

    <?php
    $args2 = array(
     'role' => 'editor',
     'meta_key' => 'rolle_sort',
     'orderby'  => 'meta_value',
     'order' => 'ASC'
    );
    
    $members = get_users($args2);
    
    echo '<table cellpadding="0" cellspacing="0">';
    foreach ($members as $user) {
    
    $path1 = "https://domain-name.com/wp-content/uploads/ultimatemember/";
    $path2 = $user->ID;
    $file = $user->profile_photo;
    $logo = '<img src="' .$path1 . $path2 . "/" . $file . '">';
    
    echo '<tr>';
    echo '<td>' . '<strong>' . $user->rolle . ':' .'</strong>' . '</td>';
    echo '<td>' . $user->first_name . ' ' .$user->last_name .'</td>';
    echo '<td>' . $logo .'</td>';
    echo '</tr>';
    }
    echo '</table>';
    
    ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Custom Userlist with Avatar’ is closed to new replies.