• Hi, I use some custom roles on my WordPress. Activity Log plugin doesn’t work on them. Is it possible to recover?
    Thanks for your work

Viewing 1 replies (of 1 total)
  • @marcorroma Yes, the current version of the plugin does not render the activity of custom roles. So I used a plugin filter to append all custom roles. Please see the code below.

    /**
     * Allow administrator to see the activity of all roles, including custom roles.
     * It also appends custom roles in 'All Roles' dropdown filter.
     *
     * @param $caps array
     * @return $caps
     */
    function custom_aal_caps( $caps ) {
        global $wp_roles;
    
        $all_roles = $wp_roles->get_names();
    
        if ( ! empty( $all_roles ) ) {
            foreach ( $all_roles as $key => $value ) {
                if ( ! in_array( $key, $caps['administrator'] ) ) {
                    array_push( $caps['administrator'], $key );
                }
            }
        }
    
        return $caps;
    }
    add_filter( 'aal_init_caps', 'custom_aal_caps', 10, 1 );

    thank you

Viewing 1 replies (of 1 total)
  • The topic ‘With custom roles’ is closed to new replies.