1

Hi i have bbPress forum and i want to display information about user online status in posts comments.

  • If comment author is logged in: online
  • If comment author is logged out: offline
  • If comment author doesn't have an account: not registred

How do this correctly? I found only something like that:

add_action('user_online_status', 'bbp_user_online_status');
function bbp_user_online_status(){
    global $bbpuos_options;
    echo '<ul>';
    $user_id = bbp_get_reply_author_id($reply_id);
        if ($bbpuos_options['activate'] == true) {
        echo '<li class="bbp-online-status">';
         if (is_user_online($user_id)) {
            echo 'online';
         } else {
            echo 'online';
         }
         echo '</li>';
     }
}

I try change this:

$user_id = bbp_get_reply_author_id($reply_id);

To this but it doesn't work:

$user_id = get_comment_author($comment_ID);
Avigo
  • 149
  • 1
  • 1
  • 9
  • get_comment_author returns a string, the commen author’s name. That you can not just substitute that for a function call that returns a user id, should be obvious. https://wordpress.stackexchange.com/a/231399 shows a way to get the id; there might be more direct ways, do some additional research on that maybe. – CBroe Mar 21 '18 at 08:08

0 Answers0