wpDiscuz 7 API Documentation

  1. Home
  2. Docs
  3. wpDiscuz 7 API Documentation
  4. Filters
  5. wpdiscuz_user_label
Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages

wpdiscuz_user_label

This filter can be used to change the printed user role. The hook works only if the user is not the author of the current post and it doesn’t work for guests.

Changelog

Since 70.0. version

Parameters

1. $role (type: string) – the user role
2. $user (type: WP_User object) – the object of the current user

Usage

add_filter("wpdiscuz_user_label", function ($role, $user) {
    if ($user->ID == 1) {
        $role = "Boss";
    }
    return $role;
}, 10, 2);

Was this article helpful to you? Yes No