This means that moderators on your forum will have the same name displayed in bbPress as they do on your WordPress blog.
The plugin can be easily modified to work for all users, not just moderators.
Version: 0.7.2
Last Updated: 2006-10-27
Requires bbPress Version: 0.72 or higher
Compatible up to: 0.73





This means that moderators on your forum will have the same name displayed in bbPress as they do on your WordPress blog.
The plugin can be easily modified to work for all users, not just moderators.
A simple example plugin.
You missed a filter - this one needs to be added:
add_filter( 'get_topic_last_poster', 'bb_use_display_name', 1, 2 );
(you have the one without the echo/get_)
and this one...
add_filter( 'get_topic_author', 'bb_use_display_name'
thanks for the plugin....
I wish this somehow worked on profile links when "slugs" are enabled.
I can force it to trick the link to use the display name but on the destination, the profile.php does not know how to interpret the display name.
Okee I'll work on this for a bit, I think the solution is to just use the user id # instead of the name when it's a mod.
TADA!
add this to display-name.php to force mods's profile links to use their id #'s instead of their login names when "slugs" are enabled - everyone else still gets pretty slugs
function bb_use_display_name_profile_link($r, $id) {
$user_obj = new BB_User( $id ); //Mod
if ( $user_obj->has_cap('moderate') ) { //Mod
if ( bb_get_option( 'mod_rewrite' ) === 'slugs') {
$r = bb_get_option('uri') . "profile/" . $id; // . ( 1 < $page ? "/page/$page" : '' ); not sure how to handle pages since they aren't passed
}
} // Mod
return $r;
}
add_filter( 'get_user_profile_link', 'bb_use_display_name_profile_link',1, 2)
Doesn't handle pages on profile links though. Not sure how to deal with that. I could take the orignal link build and just do a search and replace for their login name to the id # .... hmm...
Okay this version does a search/replace so it leaves anything appended to the uri intact. In theory.
function bb_use_display_name_profile_link($r, $id) {
$user_obj = new BB_User( $id ); //Mod
if ( $user_obj->has_cap('moderate') ) { //Mod
if ( bb_get_option( 'mod_rewrite' ) === 'slugs') {
$user = bb_get_user( bb_get_user_id( $id ) );
$r=str_replace("/profile/".$user->user_login,"/profile/".$id,$r);
}
} // Mod
return $r;
}
add_filter( 'get_user_profile_link', 'bb_use_display_name_profile_link',1, 2)Hello this is a great plugin, it does what the description said, but I discover that for some reason if I have the plugin active I can't submit votes on the topics and sometime I won't let me delete topic that I created. Any advice?
Hi, This is causing permissions issues with the most recent version of BBPress, 8.3. Among the problems are:
*No permission to create forums
*No permission to delete posts
*No permission to add more than one tag
*No permission to edit posts
Basically, seems like the usual keymaster rights aren't working.
Thanks!
I am experiencing similar problems as Jolacdana. The most serious problem is that nobody is allowed to add a new tag to a discussion thread, not even a keymaster user, in bbPress 0.8.3. After deactivating the plugin, everything works normal. It is a strange bug I did not expect.
But at the moment, I cannot decide that the bug is in the plugin - it may be a bbPress bug as well. Someone has to look at it.
There is a thread in the forum for this problem, which shows, that this bug causes a lot of confusion.
i am having the same problem as the previous 3 commentors, but for me the issue is with setting the support status of a given post.
basically, it breaks the Support Forum plugin (v2.3.2) with bbPress0.8.3 and WP2.3.
when (as Admin) i try to change: This topic is "resolved/not resolve/not a support question"...
i get: "You don't have permission to do that."
disabling the "Use Display Name" plugin fixes the issue.
ok, so to work around the problem, and for those who still want to show WP display names in their bbPress templates you can just edit the files in your my-tempaltes directory and replace the bb calls with wp calls..
[topic.php]
replaced get_topic_author()
with get_author_name( $topic->topic_poster )
replaced get_topic_last_poster()
with get_author_name( $topic->topic_last_poster )
[frontpage.php and forum.php]
replaced topic_last_poster()
with echo get_author_name( $topic->topic_last_poster )
[profile.php]
replaced echo get_user_name( $user->ID )
with echo $user->display_name
and so on..
for post.php - if you want the display_name wrapped in a link you can use this slightly modified version of post_author_link()
function my_post_author_link( $post_id = 0 ) {
if ( $link = get_user_link( get_post_author_id( $post_id ) ) ) {
echo '<a href="' . attribute_escape( $link ) . '">' . get_author_name( get_post_author_id( $post_id ) ) . '</a>';
} else {
echo get_author_name( get_post_author_id( $post_id ) );
}
}
i put the function in my header.php file for now.. until i find a better place for it. then, i replaced the call to post_author_link() in my-templates/post.php with my_post_author_link()
there's probably a better/shorter way to do this, but to be honest, i think i prefer dealing with display_names as a template issue. I mean, shouldn't we be modifying the display_name on the way out of the database instead of on the way in? This way, if i ever decide to deactivate this plugin (as i just did), i am not left with a mashup of WP display_names and bbPress topic_poster_names in my db..
eddd54 - should have read this before going to the effort of making this plugin work. You're right about this being better to do in a template than a plugin. I'm removing my changes and using yours.
Not sure if you forgot to mention this, but with at least my setup get_author_name() is not an available function. I created one and put it in header.php:
function get_author_name( $id ) {
$user = bb_get_user( $id );
if ( empty($user->display_name) )
return $user->user_login;
return $user->display_name;
}
get_author_name() is a function in the WordPress API, not bbPress. It works you load the WordPress API by putting require_once '/path/to/wordpress/wp-blog-header.php' in your bbPress's config.php file. But all it does is return the user's display_name.
I didn't go that route since loading the entire WordPress API's a bit heavy for something as simple as this, and slows down my site's page load time a lot. So I made a function similar to what ScottDavis did and went with that.
I'm using this plugin with a fresh install of bbPress 8.3.1 and WordPress 2.3.2. Display names from WordPress are not showing up. I might just edit my bbPress theme, but I'd prefer to have a plugin do this... any word on an update?
I think a really nice addition to this plugin would be to add a textfield to the profile page in bbPress which effectively has the same as the "Nickname" field from the usual WP profile page.
This way, forum users never have to see the WP backend, and they will have the ability to change their forum nickname.
How could this be achieved?
I'd happily add this myself if I had the PHP know how :P
This is buggy. As stated above, you'll have to patch a bunch of files following instructions given in this thread: http://bbpress.org/forums/topic/cant-add-additional-tags-to-post?replies=13
Old, but very useful plugin :)
You must log in to post.