pojome / activity-log

Get aware of any activities that are taking place on your dashboard! Imagine it like a black-box for your WordPress site.

Home Page:http://wordpress.org/plugins/aryo-activity-log/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom Roles

jmdrapeau opened this issue · comments

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,

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

hi. any solution?

thanks

hi. any solution?

thanks

No solution for this plugin

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' );

Fixed by e56cd2a