#1815 closed task (blessed) (fixed)
Display User role below usernames in replies
Reported by: | sooskriszta | Owned by: | |
---|---|---|---|
Milestone: | 2.1 | Priority: | normal |
Severity: | normal | Version: | 2.0 |
Component: | Appearance - Included Themes | Keywords: | dev-feedback has-patch |
Cc: |
Description
It is something of a standard feature. I haven't seen many forums without it.
NickMackz has submitted a "patch" at http://bbpress.org/forums/topic/displaying-user-role-beside-their-replies
To loop-single-reply.php add
<?php $reply_user_id = bbp_get_reply_author_id(); global $wp_roles; $reply_user = new WP_User( $reply_user_id ); $roles = $reply_user->roles; $role = array_shift($roles); printf( isset($wp_roles->role_names[$role]) ? translate_user_role($wp_roles->role_names[$role] ) : false); ?>
I suggest it be tested and included in 2.1
Attachments (2)
Change History (12)
#2
@
12 years ago
- Keywords has-patch added
Additional functionality like badges and achievements etc may be plugin territory, but the basic functionality of displaying role should really be a part of the core.
#3
@
12 years ago
- Keywords needs-patch added; has-patch removed
I would agree that this should be added, especially since it's part of the standalone bbPress package. However, the patch needs some work, and the addition of some filters. The code also needs to be in the form of a function, and possibly use an action to add it to the template.
#4
@
12 years ago
- Milestone changed from 2.1 to 2.2
I looked into this in 2.0, and it caused a significant number of additional queries. I agree with cnorris23, and would like us to have an efficient way to make it happen.
Moving to 2.2. If a patch comes through before 2.1 ships, I'm okay squeezing it in.
#5
@
12 years ago
- Keywords has-patch added; needs-patch removed
First draft
I took a different approach than my original comment, but I think this will be easier for majority of users. However, there are still enough filters and individual functions floating around to allow for more control for those so inclined.
@jjj Was about to post the patch when I realized you had posted not long before. Default WP/bbPress install. No effect on query number. WP reported the same number of queries with and without the role being shown.
#6
@
12 years ago
Just had a look through your patch. Looks a lot better than mine (obviously). Mine was just a quick fix to do it as I am not really familiar with php as I normally program in Java.
The only thing that I'm not sure about with your patch is whether or not it will work with custom user roles or just the default ones? I use custom roles on my website and forums. The forums are members only so there's no point me posting a link, so here's a screenshot (I've hidden the IPs):
#7
@
12 years ago
@NickMackz It will work, but, in it's current form, you'll have to use the filters for custom roles.
#8
@
12 years ago
- Milestone changed from 2.2 to 2.1
New patch. Reworked the switch/case logic so that custom roles are now displayed without having to use filters. Also reworked the actual display of the role. Still not sure it's the best way display the role, but it seems like the best entry place to allow users to gain access to the feature without having to edit custom templates. Plus, as I said earlier, there's enough functions and filters to allow those so inclined to customize as they see fit with little effort.
Moving back to 2.1.
I'd say this is plugin territory. There's no one way of doing this. Some want plain text titles, others want image badges, others might integrate Achievements and so forth.