I am using WordPress with MU activated. I found a function here that supposed to return an object with the current side ID. But it's returning 1 for all websites.
<?php get_current_site(); ?>
I am using WordPress with MU activated. I found a function here that supposed to return an object with the current side ID. But it's returning 1 for all websites.
<?php get_current_site(); ?>
You're right, get_current_site()->blog_id
will return 1, as it refers to the network.
To get the current site (blog) ID you can go like this:
<?php echo get_current_blog_id(); ?>
Moreover you can get the current site (blog) details like this:
<?php var_dump(get_blog_details()->blog_id); ?>
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>';
?>