BBpress causing role issue (making new users have no role)

Whenever a new user is added to a blog on a network install, they are set to no role automatically forcing the site admin to manually add them. I disabled it, now everything works fine. I was hoping someone out there has dealt with this before, before I spend hours reading through the code until my eyes fall out. Thanks. (This is on a multisite install)

  • PC

    Hey there,

    Thanks for your post.

    Can you make sure that you are running the latest versions of BuddyPress, bbPress and WordPress ?

    Also did you check it with all other plugins disabled ? Perhaps you are running any user role editor plugin ?

    Here is a thread : http://bbpress.org/forums/topic/two-bugs-with-bbpress-2-2-4-and-wordpress-multisite-3-4-2/ which "might" help.

    Please advise.

    Cheers
    PC
    Sales &Support

  • Jack Kitterhing

    Hi there @Brashell

    I hope you are well today and sorry about the issue your having, I believe that this is a known issue with BBpress and the latest WordPress install on a multisite configuration.

    Can you send me through the following please

    - In the subject field add "Attn: Jack Kitterhing"
    - Link back to this thread
    - Include admin/network access
    - Include FTP
    - Include any relevant URLS for your site

    On the contact form, select "I have a different question", this ensures it comes through and gets assigned to me.

    https://premium.wpmudev.org/contact/

    Then I can test for a couple of different issues :slight_smile:

    Thank you!

    Kind regards
    Jack.

  • Brashell

    Hey Jack I mostly fixed it but I am not quite there. The users are finally being added as subscribers to each site. There is only one problem though, they are being set to no role for the site even thought they should be. When I go into the tools and do the Remap existing users to default forum roles then they all get the participation role for forums, but unless I do that they just get a 404 that they can't access it. Now my proposed idea is this. Using the code below that I use to add new users to the site when they visit, somehow we need to make it so that right after the user is added, there role is repaired. Only there role though as repairing everyone is quite intensive on the DB. So is there some way we can do this?

    <?php

    /*
    Plugin Name: Add Users
    Description: Add users to blogs when they visit.
    */

    function helf_add_users( ) {
    global $current_user, $blog_id;

    if(!is_user_logged_in())
    return false;

    if( !is_user_member_of_blog() ) {
    add_user_to_blog($blog_id, $current_user->ID, "subscriber");
    $bbp_admin_repair_user_roles;
    }
    }

    add_action( 'wp' , 'helf_add_users' , 10);

    ?>

  • Brashell

    Hey @Jack Kitterhing I mostly fixed it but I am not quite there. The users are finally being added as subscribers to each site. There is only one problem though, they are being set to no role for the site even thought they should be. When I go into the tools and do the Remap existing users to default forum roles then they all get the participation role for forums, but unless I do that they just get a 404 that they can't access it. Now my proposed idea is this. Using the code below that I use to add new users to the site when they visit, somehow we need to make it so that right after the user is added, there role is repaired. Only there role though as repairing everyone is quite intensive on the DB. So is there some way we can do this?

    <?php

    /*
    Plugin Name: Add Users
    Description: Add users to blogs when they visit.
    */

    function helf_add_users( ) {
    global $current_user, $blog_id;

    if(!is_user_logged_in())
    return false;

    if( !is_user_member_of_blog() ) {
    add_user_to_blog($blog_id, $current_user->ID, "subscriber");
    $bbp_admin_repair_user_roles;
    }
    }

    add_action( 'wp' , 'helf_add_users' , 10);

    ?>

  • Brashell

    Hey @Jack Kitterhing I mostly fixed it but I am not quite there. The users are finally being added as subscribers to each site. There is only one problem though, they are being set to no role for the site even thought they should be. When I go into the tools and do the Remap existing users to default forum roles then they all get the participation role for forums, but unless I do that they just get a 404 that they can't access it. Now my proposed idea is this. Using the code below that I use to add new users to the site when they visit, somehow we need to make it so that right after the user is added, there role is repaired. Only there role though as repairing everyone is quite intensive on the DB. So is there some way we can do this?

    <?php

    /*
    Plugin Name: Add Users
    Description: Add users to blogs when they visit.
    */

    function helf_add_users( ) {
    global $current_user, $blog_id;

    if(!is_user_logged_in())
    return false;

    if( !is_user_member_of_blog() ) {
    add_user_to_blog($blog_id, $current_user->ID, "subscriber");
    $bbp_admin_repair_user_roles;
    }
    }

    add_action( 'wp' , 'helf_add_users' , 10);

    ?>

  • Jack Kitterhing

    Hi there @Brashell

    I hope you are well today, thanks for the additional information.

    I've just been discussing this with one of our lead developers. We'd both recommend not using any code like that, it isn't good for the DB or performance. That sort of fix should be avoided if possible.

    How did you fix the original issue of users having no roles? As there must be an underlying issue here, perhaps with the DB or a plugin/theme conflict, could we perhaps test this further and see what's happening here?

    I'm here to help, look forward to your reply :slight_smile:

    Thank you!

    Kind Regards
    Jack.

  • Brashell

    Auto role had t be turned off, once I did that users were added as subscribers, but now they have no role in the forums which is causing them to not be able to read them. So somehow we need to make it so that when they enter the site for the first time, how they are added automatically via this:

    <?php

    /*
    Plugin Name: Add Users
    Description: Add users to blogs when they visit.
    */

    function helf_add_users( ) {
    global $current_user, $blog_id;

    if(!is_user_logged_in())
    return false;

    if( !is_user_member_of_blog() ) {
    add_user_to_blog($blog_id, $current_user->ID, "subscriber");
    }
    }

    add_action( 'wp' , 'helf_add_users' , 10);

    ?>

    That they are also added as a participant via bbp_participant. I am still trying to think of a way that we can do of sorts blog_id fetch the current user, get there ID, and set in the profile user as bhp_participant. I was able to accomplish tho by replacing subscriber with bhp_paticipant but then they weren't set as subscriber so they couldn't access the backend. Please advise.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.