I'm using the plugin "user following system" and all I need to get is a list of users which I follow. I tried it with the snippet below but it always returns an array! What am I doing wrong?
function pwuf_get_following( $user_id = 0 ) {
if ( empty( $user_id ) ) {
$user_id = get_current_user_id();
}
$following = get_user_meta( $user_id, '_pwuf_following', true );
if ( empty( $following ) ) {
return;
}
return (array) apply_filters( 'pwuf_get_following', $following, $user_id );
ob_start(); ?>
<ul>
<?php
$following = get_user_meta( $user_id, '_pwuf_following', true );
foreach( $following as $user ) { ?>
<li><?php echo $user->first_name; ?> <?php echo $user->last_name; ?></li>
<?php } ?>
</ul>
<?php
return ob_get_clean();
}
add_shortcode( 'following', 'pwuf_get_following' );
</div>