wpDiscuz 7 API Documentation

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

wpdiscuz_author_title

This filter can be used to change the user role in the comment form. This hook works for both registered users and guests.

Changelog

Since 7.0.0 version

Parameters

1. $role (type: string) – the role of the user
2. $comment (type: WP_Comment object) – the object of the comment

Usage

add_filter("wpdiscuz_author_title", function ($role, $comment) {
    if ($comment->user_id == 1) {
        $role = "Boss";
    }
    return $role;
}, 10, 2);

Was this article helpful to you? Yes No