Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] bp_moderate capability?


  • Ryan Hale
    Participant

    @ryanjhale

    I created a new user role and gave them the capability bp_moderate as it appeared that was what was needed to be able to access Groups in admin:

    $hook = add_menu_page(
    __( ‘Groups’, ‘buddypress’ ),
    __( ‘Groups’, ‘buddypress’ ),
    ‘bp_moderate’,
    ‘bp-groups’,
    ‘bp_groups_admin’,
    ‘div’
    );

    I confirmed that bp_moderate was added to the role and that the user is connected to the role. However, the user isn’t able to see the Groups menu.

    Am I off-base in thinking this is how a user should be able to access the Groups item in the admin menu?

    Thanks in advance,

    Ryan

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

  • danbp
    Moderator

    @danbp

    @ryanjhale,

    wp roles and bp capacities are two diffrent things.
    bp_moderate has a specific usage applied to the site admin only. If you read what is written in bp-core-caps.php, you’ll see this comment at line 200

    
     * Temporary implementation of 'bp_moderate' cap.
     *
     * In BuddyPress 1.6, the 'bp_moderate' cap was introduced. In order to
     * enforce that bp_current_user_can( 'bp_moderate' ) always returns true for
     * Administrators, we must manually add the 'bp_moderate' cap to the list of
     * user caps for Admins.
     *
     * Note that this level of enforcement is only necessary in the case of
     * non-Multisite. This is because WordPress automatically assigns every
     * capability - and thus 'bp_moderate' - to Super Admins on a Multisite
     * installation. See {@link WP_User::has_cap()}.
     *
     * This implementation of 'bp_moderate' is temporary, until BuddyPress properly
     * matches caps to roles and stores them in the database. Plugin authors: Do
     * not use this function.

    BuddyPress groups moderators are not authorized to enter the admin dashboard or the group admin on frontend. Group moderators can only delete, move and spam group activities or topics. If the group has a forum, they wil have the same capacities.

    If you want a user to be able to access the admin dashboard, you can give him an editor role (which is a wp role).

    If you want to allow him access to the group admin on the front-end, you promote him to group admin. This setting doesn’t allow that user to enter the site admin. He’s only a group admin (with a wp role of subscriber, by default) and not a site admin (admin or super-admin (MS) ).


    Ryan Hale
    Participant

    @ryanjhale

    Thanks danbp. At this point, I’m just trying to solve for users with this new role type to have access to the Groups area in admin. Below are the capabilities that I’ve given the role. Unfortunately, in my testing so far, the only way I can get Groups (and Activity) to show up in admin is if I set manage_options to True, which is undesirable. But does that jive with your understanding that it needs to be True to make this work?

    (Quick note that this is non-multisite)

    Here is a screenshot showing the missing Groups admin area:

    https://www.dropbox.com/s/jyu4pign0aaghlt/Screen%20Shot%202014-09-09%20at%2010.13.46%20AM.png?dl=0

    And here are the capabilities for the user with the role that I’ve created:

    activate_plugins => false,
    delete_others_pages => true,
    delete_others_posts => true,
    delete_pages => true,
    delete_plugins => false,
    delete_posts => true,
    delete_private_pages => true,
    delete_private_posts => true,
    delete_published_pages => true,
    delete_published_posts => true,
    edit_dashboard => false,
    edit_files => false,
    edit_others_pages => true,
    edit_others_posts => true,
    edit_pages => true,
    edit_posts => true,
    edit_private_pages => true,
    edit_private_posts => true,
    edit_published_pages => true,
    edit_published_posts => true,
    edit_theme_options => false,
    export => true,
    import => false,
    list_users => true,
    manage_categories => true,
    manage_links => true,
    manage_options => false,
    moderate_comments => true,
    promote_users => true,
    publish_pages => true,
    publish_posts => true,
    read_private_pages => true,
    read_private_posts => true,
    read => true,
    remove_users => true,
    switch_themes => false,
    upload_files => true,
    update_core => false,
    update_plugins => false,
    update_themes => false,
    install_plugins => false,
    install_themes => false,
    delete_themes => false,
    edit_plugins => false,
    edit_themes => false,
    edit_users => true,
    create_users => true,
    delete_users => true,
    unfiltered_html => true,
    bp_moderate => true


    r-a-y
    Keymaster

    @r-a-y

    @ryanjhale – Sounds like a bug.

    Can you post a ticket on our ticketing system?
    https://trac.buddypress.org/newticket

    Use the same login credentials as you do here.

    Thanks!


    danbp
    Moderator

    @danbp

    See in bp-groups/bp-loader.php how the menu is built
    Ad if not already done, read here: https://codex.buddypress.org/plugindev/extend-groups-admin-ui/


    Ryan Hale
    Participant

    @ryanjhale

    @danbp:

    The link you posted for reading assumes that you can actually access the Groups admin area, but that is precisely the problem as I can’t.

    Also, I’m fairly new to BP plugin development, but I’m feeling pretty sure that I’m looking at the right place for how the admin menu is built. Here is what I posted in the original question, which comes from bp-groups/bp-groups-admin.php:

    $hook = add_menu_page(
    __( ‘Groups’, ‘buddypress’ ),
    __( ‘Groups’, ‘buddypress’ ),
    ‘bp_moderate’,
    ‘bp-groups’,
    ‘bp_groups_admin’,
    ‘div’
    );


    @r-a-y
    :

    I’ll post a bug in trac.

    Thanks,

    Ryan


    r-a-y
    Keymaster

    @r-a-y

    @ryanjhale – I’ve posted a fix here:
    https://buddypress.trac.wordpress.org/ticket/5869

    This probably won’t make v2.1 since we’re close to releasing this version. I’ve tentatively put the fix for v2.2.

    Thanks for reporting!


    Ryan Hale
    Participant

    @ryanjhale

    @r-a-y, that appears to have done the trick. Great, and thank you!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] bp_moderate capability?’ is closed to new replies.
Skip to toolbar