Making WordPress.org

Changeset 9159


Ignore:
Timestamp:
10/02/2019 08:20:39 AM (7 years ago)
Author:
tellyworth
Message:

HelpHub: fix role assignment for support users.

This fixes a conflict that made it impossible to set a HelpHub role for users with an existing support role.

It also removes an unnecessary edit_theme_options capability for HelpHub editors.

Props Clorith.
Fixes #4700.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-customroles/class-helphub-custom-roles.php

    r7306 r9159  
    223223                if ( empty( $GLOBALS['wp_roles']->is_role( $role ) ) ) {
    224224                        $wp_roles->add_role( $role, __( 'HelpHub Editor', 'wporg-forums' ), $default_editorroles->capabilities );
    225 
    226                         $wp_roles->add_cap( $role, 'edit_theme_options' );
    227225                }
    228226        }
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-manager/class-helphub-manager.php

    r7958 r9159  
    182182                /*
    183183                 * Only allow changing roles of users that are HelpHub related, or do not already hold
    184                  * a role within the user hierarchy as is.
     184                 * a role within the user hierarchy with sufficient capabilities to modify HelpHub articles.
    185185                 *
    186186                 * This is to prevent overriding users with higher capabilities altogether.
    187187                 */
    188                 if ( ! empty( $user_role ) && ! isset( $helphub_roles[ $user_role ] ) ) {
     188                if ( ! empty( $user_role ) && ! isset( $helphub_roles[ $user_role ] ) && user_can( bbp_get_displayed_user_id(), 'edit_posts' ) ) {
    189189                        return;
    190190                }
Note: See TracChangeset for help on using the changeset viewer.