Support » Plugin: User Role Editor » Pixel Your Site permission

  • Resolved Michele

    (@mathrim87)


    Hi,
    I tried to give the permission to access the plugin Pixel your site (manage_pys) to a user role. I’ve confirmed and saved, but when I refresh the user role editor page, the check on the permission ‘manage_pys’ disappear.
    I tried with several different roles but I cannot provide plugin access to a role other than administrator.
    I would really appreciate some tips in order to solve this problem.
    Regards,
    Michele

    • This topic was modified 11 months, 1 week ago by Michele.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Vladimir Garagulia

    (@shinephp)

    Hi Michele,

    This plugin manages own access itself. Go to menu “PixelYourSite->Dashboard”, scroll it down and add your user role to the list of role at “Permissions” field.
    PYS plugin applies this code on ‘admin_init’ action, and automatically adds/removes its own ‘manage_pys’ capability to/from allowed/not allowed roles:

    function manageAdminPermissions() {
        global $wp_roles;
        
        $roles = PYS()->getOption( 'admin_permissions', array( 'administrator' ) );
        
        foreach ( $wp_roles->roles as $role => $options ) {
            
            if ( in_array( $role, $roles ) ) {
                $wp_roles->add_cap( $role, 'manage_pys' );
            } else {
                $wp_roles->remove_cap( $role, 'manage_pys' );
            }
            
        }
    }
    Thread Starter Michele

    (@mathrim87)

    Perfect, thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Pixel Your Site permission’ is closed to new replies.