Reply To: Cant add WP user as forum moderator as username has space in it
Thanks for that – very useful.
Wordpress has a bewildering set of names including username, user display name and user nicename
As far as I can see, bbpress seems to be using the user database setting for user nicename.
So can you try adding this code
add_filter( 'manage_users_columns', 'rew_add_user_nicename', 20, 1);
add_filter( 'manage_users_custom_column','rew_add_user_row', 20, 3 );
function rew_add_user_nicename($columns) {
$new = array();
foreach($columns as $key => $title) {
$new[$key] = $title;
//add the 2 columns after the forum role column
if ($key=='bbp_user_role') {
$new['nicename'] = 'Nicename';
}
}
return $new;
}
function rew_add_user_row($retval = '', $column_name = '', $user_id = 0) {
if ($column_name == 'nicename') {
$user_info = get_userdata($user_id);
$user_nicename = $user_info->user_nicename;
$retval = '-->'.$user_nicename.'<--';
}
return $retval ;
}
Put this in your child theme’s function file –
ie wp-content/themes/%your-theme-name%/functions.php
where %your-theme-name% is the name of your theme
or use
This will add a column to the dashboard>users table to show you exactly what is set as the user nicename. I have enclosed it in arrows eg
–>name here<–
so you can see if there are leading or trailing spaces.
try adding that name to the moderators and see if that works?