Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] User Roles

  • Avatar of garynagel
    garynagel
    Participant

    @garynagel

    I’ll try to explain my issue better I am testing buddypress for a school program and I need Super Admin (tech guy) and Admin (it trainers) Authors (teachers) to be able to create blogs, However there is not option to limit only admins and authors to the create a blog option.

    Say Im a teacher and I ad a student in my blog as a subscriber
    that kid could now create a blog and it auto makes him an admin of the blog

    I need to be able to restrict subscribers and editors from the create a blog option but allow Super Admin, Admin, and Authors access to the create a blog.

    I don’t wish to give any Teachers super admin access that would open up trouble in itself.

    Please do not respong by stating in Mu you can go an turn off the create a blog option. For some reason that is the only responce I get and I am aware of that option big time please read my issue again. Upon searching the forums it seams I am not the only one with this issue and it always seams to get answered by hey just turn of creating new blogs. I want my users to have the option of creating blogs I dont want my subscribers and editors to create them

Viewing 2 replies - 1 through 2 (of 2 total)
  • BuddyPress currently has no option to do this sort of thing.

    Avatar of Travel-Junkie
    Boris
    Participant

    @travel-junkie

    These functions should sort you out, garynagel:

    function sv_check_current_users_blog( $active_signup )
    {
    if( ! is_user_logged_in() )
    return $active_signup;

    if( current_user_can( 'YOUR_CAPABILITY' ) )
    return $active_signup;
    else
    return 'none';
    }
    add_filter( 'wpmu_active_signup', 'sv_check_current_users_blog' );

    function sv_remove_create_blog()
    {
    if( ! current_user_can( 'YOUR_CAPABILITY' ) )
    bp_core_remove_subnav_item( 'blogs', 'create-a-blog' );
    }
    add_action( 'wp', 'sv_remove_create_blog' );

    You need to place these functions in your themes functions.php and replace YOUR_CAPABILITY with whatever capability you want to check for. You also need to have blog creation enabled. I’m using a slightly modified version of this to restrict users to maximum 1 blog, so I didn’t test this code at all.

    The first function uses a filter to set the variable $active_signup to ‘none’ if the current user does not have a certain capability and for that user blog creation will be disabled. If the user has that capability the variable is not changed.

    The second function removes the blog creation tab from the submenu. You probably need to modify the registration page as well.

    Hope this helps.

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

The topic ‘[Resolved] User Roles’ is closed to new replies.