Info
- 2 posts
- 2 voices
- Started 7 months ago by derekpunsalan
- Latest reply from dominornovus
bbp_reply_class() output user role?
-
- Posted 7 months ago #
Just getting around to playing with bbPress after it being released as a plugin. Curious if I'm missing something but is there a way to output the reply author user role with bbp_reply_class? I'd like to be able to style the entire row for a reply if the response is coming from a moderator.
-
- Posted 7 months ago #
I've had a look at bbp-includebpp-reply-template-php here:
http://etivite.com/api-hooks/bbpress/path/bbp-includesbbp-reply-template-php/I looked through the following:
bbp_get_reply_author_url
bbp_get_reply_author_link
bbp_get_reply_author_id
bbp_get_reply_author_email
bbp_get_reply_author_display_name
bbp_get_reply_author_avatar
bbp_get_reply_authorIt seems like you could use this one as a base for getting the role:
http://etivite.com/api-hooks/bbpress/trigger/apply_filters/bbp_get_reply_author/There's also a specific solution suggested here:
http://bbpress.org/forums/topic/display-reply-author-rolefunction get_the_author_role() { global $wpdb, $wp_roles, $authordata; if ( !isset($wp_roles) ) $wp_roles = new WP_Roles(); foreach($wp_roles->role_names as $role => $Role) { $caps = $wpdb->prefix . 'capabilities'; if (array_key_exists($role, $authordata->$caps)) return $Role; } } function the_author_role() { echo get_the_author_role(); }There's another topic here that discusses various ways of styling replies based on the user role:
http://bbpress.org/forums/topic/different-style-for-key-master-and-administrator-replies-1
Let me know how it goes.
-
You must log in to post.