(yet another) integration bug, no Role set on registration
-
I’ve just discovered that any member who registers through BBpress instead of WordPress never gets a Role set (ie. Subscriber) so while they can use the forum, they can do anything on the WordPress part, even though they are logged in.
-
Another one to put on TRAC _ck_ !
Trent
This is what i do to solve the problem:
function wpbb_add_user_role_rk($user_id) {
$user = new WP_User($user_id);
$user->set_role(get_option('default_role'));
}
add_action( ‘bb_new_user’, ‘wpbb_add_user_role_rk’);
Ah thanks Detective! One less function for me to research and develop (slowly and badly).
I’ve got a tweaks.php plugin just full of these things.
We need a sub-forum for “hacks and tweaks” !
Where do I put this code? In bbpress/register.php somewhere I’m assuming?
I’m learning slowly Figured it out.
this plugin gives me a “headers all ready sent” error
ganzua, “headers already sent” means you have left white space before or after the plugin you made (or edited)
ie.
(remove any spaces here)<?php
blah blah
?>(remove any spaces here)“ganzua, “headers already sent” means you have left white space before or after the plugin you made (or edited)”
ooops!, I’m going to check but I think I just copy/pasted
I’m trying the plugin right now, so far everything running ok
I’m trying to create this plugin. When I try to register using bbPress, I get this error message…
Fatal error: Class ‘WP_User’ not found in /home/sbisdedt/public_html/web20/forum/my-plugins/default-role.php on line 11
The registration actually takes place; the person receives the email with the password; their registration shows up in both WordPress and bbPress.
But how do I stop that error message from appearing. What could I have possibly done wrong.
Thanks for your help.
K
Ah apparently Detective’s method is for sites running WP at the same time as bbPress (not just integrated, running within each other – which I do not recommend). So this won’t work for most people.
I solved the problem by forcing all registration links to go through WordPress but obviously that’s not a perfect answer (and needs core hacks).
So this problem needs to be revisted again
Two things:
I DO have my bbPress folder running inside my WordPress folder. You’re thinking this is a bad idea??? Any suggestions as to why? I thought I read on here that it wasn’t a bad idea to this. I probably read wrong though……
Second — if my bbPress IS actually inside my WordPress folder, any other ideas why I’m getting the error message?
I guess one more (sorry)…if you’re forcing all registration links to go to WordPress, where does this process take your users after they register? Back to bbPress? To WordPress? That might work…but for my site, I’d need it to go back to bbPress; I’m dealing with a lot non-techies and any weirdness will throw them for sure. I need to try and make it as easy as possible for them.
Thanks again for any help,
K
No I don’t mean a folder within a folder, that’s just fine and not a problem. I mean executing one within the other where they are both running at the same time on one page. That’s a huge amount of code and memory for any server, shared or dedicated.
The nice thing about the registration and login process is you can route back to any page you want as the wordpress system is much more developed. I have the code around here somewhere and posted it before…
see #5 on the list in this post:
I just discovered something and wanted to run it by the forum. I agree…when I registered in bbPress and then logged into WordPress as the administrator, that new registrant was not given a role.
However, after I actually logged on as the new person and then logged BACK on as the administrator to see what was what…the person’s role was actually changed to “Subscriber” – my default role in WordPress.
So, if this is true, and I’m not missing something that could catch me up…it seems that this whole issue might be mute. Once the user actually logs in, their role is set as the default role so their rights are restricted by that role.
Has anyone else experienced this? Am I perhaps missing something that I’m really going to regret if I don’t fix this?
Thanks,
K
kboan23,
Even if you manually fix the role of users registered in bbpress to “subscriber” the display name field is still blank. So unless I am missing something, you do need to fix this problem. Otherwise, bbpress registrants become subscribers login at wordpress and their username shows as Anonymous.
Unfortunately, Detective’s solution doesn’t work with the latest versions. I’m experiencing the same issues (integrated scenario):
User registers on bbpress and logs in there
User can acces the WP Site Admin section, but it says: Welcome, . (a space instead of the user name)
User comments are registered as ‘Anonymous’
I noticed the only way to fix this is to go to WP user management panel, editing and saving the user.
So the user has to be actively (and manually ) updated to have his name listed under his comments.
I haven’t found any way to avoid this, but if anyone can I’d be much abliged!
Detective, thanks a lot!!!
It solved my problem ( wp 2.5.1, bbpress 0.9.0.2)
Bo Fiddlesticks, you should save code in
set-default-role.php
file, put it in bb-plugins and activate<?php
/*
Plugin Name: bbpress wpmu default role
Plugin URI: https://bbpress.org/forums/topic/yet-another-integration-bug-no-role-set-on-registration?replies=5
Description: Sets a default WPMU role for all new bbpress users.
Author: Detective
Author URI: http://www.ryuuko.cl/
*/
function wpbb_add_user_role_rk($user_id) {
$user = new WP_User($user_id);
$user->set_role(get_option('default_role'));
}
add_action( 'bb_new_user', 'wpbb_add_user_role_rk');
?>
- You must be logged in to reply to this topic.