Skip to:
Content
Pages
Categories
Search
Top
Bottom

Two bugs with bbPress 2.2.4 and WordPress Multisite 3.4.2?


  • sontru
    Participant

    @sontru

    If bbPress is running on a WordPress Multisite subdomain, then it seems to be adding network users who visit a sub site to the sub site’s users as participants – this includes the super-admin!

    Activate bbPress plugin on a subdomain and ths default setting is unchecked:

    `
    Auto role | Automatically assign default role to new, registered users upon visiting the site.
    `

    Visit the sub site as any network user, and they are added as a participant! Only after checking the Auto role option, saving and unchecking it and saving again, does this work as intended.

    The second bug is a major one and can only be stopped by deactivating bbPress!

    I am writing a plugin which creates users and adds them to blogs. I am using the add_user_to_blog* function and each time I call it with bbPress activated, it adds the admin user who is calling the function to ALL blogs as a participant! If I go into a subdomain as a admin user of that site, this admin user is not listed (even in subdomain who have bbPress enabled), but I as this admin can see all sites are listed in my Sites drop down. I manually look into the database and see in the wp_usermeta table that this user has capabilities and level (of 0) entries for all blogs!

    Of course if I deactivate bbPress and call up the add_user_to_blog, everything works as expected, and the user calling up the function does not get added as a participant to ALL the sub sites! I think there is some sort of filter that bbPress is applying that is causing this.

    Could someone look at this and see if they can replicate it and fix it?

Viewing 12 replies - 1 through 12 (of 12 total)

  • Shane Gowland
    Participant

    @thewebatom


    sontru
    Participant

    @sontru

    You misunderstand – I don’t want network users to be added as a participant! (The bug is that bbPress does this even, at installation/activation, the default option says not too!)

    The second bug is a bigger problem here, as there is no work-around except disabling bbPress!

    (I did see your plugin and article before posting, and thought the code had been absorbed into bbPress, but obviously not. If the feature is already present, why write this plugin?)


    Shane Gowland
    Participant

    @thewebatom

    The ‘participant’ role is one of WordPress’ user roles. bbPress assigns the bbp_participant role, which makes me think there is something else going on here. Are you running any other plugins or custom functions?

    Perhaps you could use something like Multisite User Management to set ‘no role’ as the default across the network. You might need to make some code changes to it though.

    What does your add_user() function look like? It sounds like this could be resolved by wrapping your code in a !is_admin() conditional.


    sontru
    Participant

    @sontru

    Participant is not one of WordPress’s user roles! It only gets introduced with bbPress.

    There’s nothing wrong with my add_user() function (I don’t have one!) The problem occurs when calling up the WordPress function ‘add_user_to_blog’ when bbPress is active.

    Is there a way of reporting bugs found in bbPress?


    sontru
    Participant

    @sontru

    I found the bug report pages and have logged the two issues:

    http://bbpress.trac.wordpress.org/ticket/2205

    http://bbpress.trac.wordpress.org/ticket/2206


    Shane Gowland
    Participant

    @thewebatom

    I think youre right that the first is a bug. Ive been able to reproduce.

    The second issue doesnt seem very bug-like though. Could you share the code that is calling the add_user function? As I said before, I suspect you’re not doing any validation on the situations ion which the function is allowed to run.


    sontru
    Participant

    @sontru

    Thanks for confirming the first bug. (I’ve also found that this bug can be fixed by simply saving the settings as is.)

    I’ve been doing some more investigation on the second issue. It looks like it is not the add_user_to_blog function but the wp_create_user function (probably used in conjuction with add_user_to_blog) that is causing the problem. I’ve written a simple admin page (menu item appears under the Users menu) that will manifest the issue on my multisite setup.
    `
    [code with angle brackets removed to be posted]
    `
    Unfortunately, I have not been able to replicate this using a new install of WordPress MS v3.4.2, bbPress and a few sub sites and users. I will have to carry on looking to why my live MS site is causing this issue to manifest.


    sontru
    Participant

    @sontru

    `
    <?php
    /*
    Plugin Name: Test add_user_to_blog with bbPress
    Plugin URI:
    Description: Does what it says! Menu item will appear under Users Menu in admin’s CP
    Author: sontru
    Version: 1.0.0
    Author URI:
    */

    add_action( ‘admin_menu’, ‘ad_the_wp_menu’);

    function ad_the_wp_menu() {
    global $bbtestpage;
    $bbtestpage = add_users_page(‘bbPressBugtest’, ‘bbPress Bug Test’, ‘administrator’, __FILE__, ‘addsutoblogfunc’);
    }

    function addsutoblogfunc()
    {
    if(trim($_POST['username']) === ” || trim($_POST['email']) === ”) {
    echo ‘<h3>bbPress Bug Test</h3>’;
    echo ‘<p>Activate the bbPress plugin. Add a user using this page, refresh by displaying to All Users. If there is an issue, all sub sites will appear in this user\’s My Sites drop down list.</p>’;
    echo ‘<form method=”post” name=”create-user-test” action=”‘ . the_permalink() . ‘” />’;
    echo ‘Username: <input type=text value=”” name=”username”> Email: <input type=text value=”” name=”email”><input type=submit value=”Create User”>’;
    }
    else {
    $my_user = trim($_POST['username']);
    $my_email = trim($_POST['email']);
    $my_user_id = username_exists($my_user);
    if( !$my_user_id and email_exists($my_email) == false) {
    $random_password = wp_generate_password( $length=12, $include_standard_special_chars=false );
    $my_user_id = wp_create_user( $my_user, $random_password, $my_email );
    echo “<p>Creating new user: $my_user with email: $my_email | Generated userID: $my_user_id</p>”;
    if($my_user_id && !is_error_id($my_user_id))
    add_user_to_blog(get_current_blog_id(),$my_user_id,’administrator’);
    } else echo ‘<p>User: $my_user exists or email: $my_email exists! Nothing done!</p>’;
    }

    }
    ?>

    `

    Use with care!


    sontru
    Participant

    @sontru

    Hey! I’ve just installed bbPress v2.3 beta 2 ( http://bbpress.org/blog/2013/02/bbpress-2-3-beta-2/ ) and it has fixed this problem!

    I don’t know if the fix to the first bug (included in this v2.3 beta 2) help fixed this issue, but I no longer have this issue on my live site!

    Yay!


    gina
    Participant

    @ibasq2

    sontru – i tried this and it seems it is still adding network users to the main site no matter if auto role is enabled or disabled. you aren’t seeing this?

    thanks.


    sontru
    Participant

    @sontru

    No, not for me. Although, it might have remembered my settings for the previous activation and setting saving…


    gina
    Participant

    @ibasq2

    any idea on how to replicate getting it to work..?

     

    thanks. :)

Viewing 12 replies - 1 through 12 (of 12 total)

You must be logged in to reply to this topic.