Skip to:
Content
Pages
Categories
Search
Top
Bottom

Set Auto Role to false for every blog on multisite installation


  • Mike
    Participant

    @mfkelly

    Hi,
    I have multisite WordPress 3.8.1 and Buddypress 1.9.1, and have just set up separate forums using the bbPress plugin, v2.5.3

    Now everyone who is logged in and visits another site in the network is automatically made a ‘Participant’ of the site they are visiting. I don’t want this to happen.

    I have set bbp_allow_global_access( false ) in bbPress includes/admin/settings.php, line 532
    I have also set '_bbp_allow_global_access' => 0, in includes/core/options.php, line 37

    However, when I visit a new site I am still made a participant of it. How can I disable this option in all my sites (there are thousands) without setting Auto Role to unchecked and saving the forum settings page in each individual site?

    Thanks.

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

  • Mike
    Participant

    @mfkelly

    Well I set the default value for ‘allow global access’ to false in the options file:

    function bbp_allow_global_access( $default = 0 ) {
    	return (bool) apply_filters( 'bbp_allow_global_access', (bool) get_option( '_bbp_allow_global_access', $default ) );
    }

    Hopefully that together with my other changes will have done the trick.


    Mike
    Participant

    @mfkelly

    I think what is required in this context is an option to automatically assign forum roles to registered blog users, but not registered network users, as is currently the case.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Add this in a custom plugin or the functions.php of your active theme:

    add_filter( 'bbp_allow_global_access', '__return_false' );

    You’ll want to undo the edits you’ve made to bbPress’s files, also.


    Mike
    Participant

    @mfkelly

    OK, thanks.
    Any thoughts on giving the site users bbPress roles automatically, rather than the network users?
    And on running:
    Tools -> Forums -> Repair Forums -> Remap existing users to default forum roles
    for all blogs too?


    Mike
    Participant

    @mfkelly

    I added a simple check in bbpress/inlcudes/users/capabilities.php to see whether the current user has a role in the current blog, before giving them a forum role:

    	/** Ready *****************************************************************/
    
    	// Load up bbPress once
    	$bbp         = bbpress();
    
    	// Get whether or not to add a role to the user account
    	$blog_role = bbp_get_user_blog_role( $user_id );
    	$add_to_site = bbp_allow_global_access() && $blog_role != false;
    

    With that in place I can reset all my previous changes so that the default setting for global access is true.
    I’ve edited the text in Forums -> Settings to show that ‘global access’ is really now just ‘site access’.

    Ideally this would be a separate option in Forums -> Settings, to limit automatic forum access to site members. I will submit a patch if I get the time.

    The problem with the default settings is that in a large Buddypress-type site, every time I visit a new site when logged in, that site is added to my My Sites list.


    MPV1
    Participant

    @mpv1

    Hi,

    I am having the exact same issue.

    have added :
    add_filter( ‘bbp_allow_global_access’, ‘__return_false’ );

    to functions.php
    no change

    I am also having alll sites added to my Admin sites list

    any ideas?

    Thanks

    JT


    MPV1
    Participant

    @mpv1

    Hi again, have gone through this again and still new sites have the auto role auto checked on sign up.

    Again, I did add the filer in functions.php and just to be sure did th is in child and mother.

    still no change

    really appreciate some help.

    Thanks folks 🙂

    JT

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
Skip to toolbar