Customize user stats Online/Offline badge

User statistics area in topics thread, depending on the settings, shows the Online and Offline badges. They are simple, coloured green and red. And, you can customize them and replace them with any HTML you want.

For Online status, HTML displayed is:

<span class="gdbbx-label gdbbx-status-online">Online</span>

And for Offline status, HTML displayed is:

<span class="gdbbx-label gdbbx-status-offline">Offline</span>

The display is controlled by the single filter: gdbbx_user_stats_online_status. Here is the example that will add the FontAwesome icon along the Online/Offline label.

add_filter('gdbbx_user_stats_online_status', 'custom__topic_badge_new', 10, 2);
function custom__topic_badge_new($badge, $online) {
  return '<span class="gdbbx-label gdbbx-status-'.($online ? 'online' : 'offline').'"><i class="fa fa-toggle-'.($online ? 'on' : 'off').'"></i> '.($online ? __("Online", "gd-bbpress-toolbox") : __("Offline", "gd-bbpress-toolbox")).'</span>';
Rate this article

You are not allowed to rate this post.

Leave a Comment