Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Roles #135

Closed
jmdrapeau opened this issue Feb 24, 2020 · 5 comments
Closed

Custom Roles #135

jmdrapeau opened this issue Feb 24, 2020 · 5 comments

Comments

@jmdrapeau
Copy link

We use a plugin to add custom roles. I notice that these roles are not in the Roles dropdown. Is there a hook to add them?

Thanks,

@marcorroma
Copy link

I also have the same problem. Is it possible to solve?

@colomet
Copy link

colomet commented Sep 10, 2020

hi. any solution?

thanks

@marcorroma
Copy link

hi. any solution?

thanks

No solution for this plugin

@pedalmeat
Copy link

pedalmeat commented Oct 15, 2020

Hi All.

This is my first submission in Github. Please feel free to remove if not appropriate here.

A way to handle this is to put below code in functions.php or similar.

function my_aal_init_caps( $caps ) {
    // error_log('caps: '. var_export($caps, true)); // Inspect the array
    $user = wp_get_current_user();
    if ( in_array( 'administrator', ( array ) $user->roles ) ) {
        // We create a bogus Admin role for our customers, they think they are superadmins but we restrict their caps.
        array_push( $caps['administrator'], 'admin' );
    } else {
        // Allow the bogus Admin role to inspect logs including their own but not superadmin.
        $caps['administrator'][0] = 'admin';
        // Just for shows, authors not allowed.
        unset( $caps['author'] );
    }
    return $caps;
}
add_filter( 'aal_init_caps', 'my_aal_init_caps' );

@KingYes
Copy link
Member

KingYes commented Oct 18, 2020

Fixed by e56cd2a

@KingYes KingYes closed this as completed Oct 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants