[Bb-trac] Re: [bbPress] #922: bbPress is not inserting display
names during registration
bbPress
bb-trac at lists.bbpress.org
Mon Aug 11 10:45:11 GMT 2008
#922: bbPress is not inserting display names during registration
-------------------------+--------------------------------------------------
Reporter: _ck_ | Owner:
Type: defect | Status: new
Priority: highest | Milestone: 1.0-beta & XML-RPC
Component: integration | Version: 0.9.0.2
Severity: critical | Resolution:
Keywords: |
-------------------------+--------------------------------------------------
Comment (by _ck_):
This plugin is meant as a temporarily workaround - it will replace
"anonymous" with the user login. It is meant to be installed on the
WordPress side:
{{{
<?php
/*
Plugin Name: changes anonymous to member's login if display name missing
(plugin for WordPress)
*/
function no_anonymous_members($author) { // this is a WORDPRESS plugin,
not bbPress
global $comment;
if (empty($comment->comment_author) && !empty($comment->user_id))
{$user=get_userdata($comment->user_id); $author=$user->user_login;}
return $author;
} add_filter('get_comment_author', 'no_anonymous_members');
if ( !function_exists('get_userdata') ) :
function get_userdata( $user_id ) {
global $wpdb;
$user_id = absint($user_id);
if ( $user_id == 0 )
return false;
$user = wp_cache_get($user_id, 'users');
if ( $user )
if (empty($user->display_name))
{$user->display_name=$user->user_login;}
return $user;
if ( !$user = $wpdb->get_row($wpdb->prepare("SELECT * FROM
$wpdb->users WHERE ID = %d LIMIT 1", $user_id)) )
return false;
_fill_user($user);
if (empty($user->display_name))
{$user->display_name=$user->user_login;}
return $user;
}
endif;
?>
}}}
The real answer of course is to insert the user_login when the comment is
posted however I cannot find a suitable hook in WordPress's `comment-
template.php` so I am doing it by completely replacing the get_userdata
function in `pluggable.php`
--
Ticket URL: <http://trac.bbpress.org/ticket/922#comment:4>
bbPress <http://bbpress.org/>
Innovative forum development
More information about the Bb-trac
mailing list