function widget($args, $instance) { $cf_users_status = new CF_User_Status(); echo $args['before_widget']; if (!empty($instance['title'])) { echo $args['before_title']; echo esc_html($instance['title']); echo $args['after_title']; } $cf_users_status->output_users(); echo $args['after_widget']; }
} $users[] = $user; } } return apply_filters('cf_user_status_users', $users); } function output_users() { $users = $this->get_users(); $markup = apply_filters('cf_user_status_output_before', '<ul class="cf-user-status">'); foreach ($users as $user) { $online = $user->online ? 'Online' : 'Offline'; $row = '<li>' . get_avatar($user->ID, 34) . esc_html($user->display_name . ' ' . $online) . '</li>'; $markup .= apply_filters('cf_user_status_output_row', $row, $user); } $markup .= apply_filters('cf_user_status_output_after', '</ul>'); echo $markup; } function logout() { $user_id = get_current_user_id(); self::update_activity($user_id, 0); } } function cf_user_status_output() { $cf_user_status = new CF_User_Status(); $cf_user_status->output_users; } CF_User_Status::hooks();