code formatting
Source Link
bueltge
  • 16.3k
  • 6
  • 56
  • 93

First of all check whether user belong from current site by using

 <?php is_user_member_of_blog( $user_id, $blog_id ); ?>

After you get id of user create user role

$user = new WP_User( $user_id );
if ( $user ) {
$roles = $user->roles; 

$roles = $user->roles;

and in last create posts for every user by adding role in args. not tested but i'll do trick for you.

        <?php
        $args1 = array(
         'role' => 'subscriber',
         'orderby' => 'user_nicename',
         'order' => 'ASC'
        );
         $subscribers = get_users($args1);
        echo '<ul>';
         foreach ($subscribers as $user) {
         echo '<li>' . $user->display_name.'['.$user->user_email . ']</li>';
         }
        echo '</ul>'; 

?>

}
?>

First of all check whether user belong from current site by using

 <?php is_user_member_of_blog( $user_id, $blog_id ); ?>

After you get id of user create user role

$user = new WP_User( $user_id );
if ( $user ) {

$roles = $user->roles;

and in last create posts for every user by adding role in args. not tested but i'll do trick for you.

        <?php
        $args1 = array(
         'role' => 'subscriber',
         'orderby' => 'user_nicename',
         'order' => 'ASC'
        );
         $subscribers = get_users($args1);
        echo '<ul>';
         foreach ($subscribers as $user) {
         echo '<li>' . $user->display_name.'['.$user->user_email . ']</li>';
         }
        echo '</ul>';

}
?>

First of all check whether user belong from current site by using

 <?php is_user_member_of_blog( $user_id, $blog_id ); ?>

After you get id of user create user role

$user = new WP_User( $user_id );
if ( $user ) {
$roles = $user->roles; 

and in last create posts for every user by adding role in args. not tested but i'll do trick for you.

<?php
$args1 = array(
    'role' => 'subscriber',
    'orderby' => 'user_nicename',
    'order' => 'ASC'
);
$subscribers = get_users($args1);
echo '<ul>';
foreach ($subscribers as $user) {
    echo '<li>' . $user->display_name.'['.$user->user_email . ']</li>';
}
echo '</ul>'; 

?>
Source Link

First of all check whether user belong from current site by using

 <?php is_user_member_of_blog( $user_id, $blog_id ); ?>

After you get id of user create user role

$user = new WP_User( $user_id );
if ( $user ) {

$roles = $user->roles;

and in last create posts for every user by adding role in args. not tested but i'll do trick for you.

        <?php
        $args1 = array(
         'role' => 'subscriber',
         'orderby' => 'user_nicename',
         'order' => 'ASC'
        );
         $subscribers = get_users($args1);
        echo '<ul>';
         foreach ($subscribers as $user) {
         echo '<li>' . $user->display_name.'['.$user->user_email . ']</li>';
         }
        echo '</ul>';

}
?>