-
Notifications
You must be signed in to change notification settings - Fork 116
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 capability conflict with W3TC plugin #296
Comments
This is not Stream's fault. WT3C modified the global |
@fjarrett The only way I can think of to work-around this, is to also use public static function _filter_user_caps( $allcaps, $caps, $args, $user = null ) {
$user = is_a( $user, 'WP_User' ) ? $user : wp_get_current_user();
$roles = array_unique( array_merge( $user->roles, array_keys( $user->caps ) ) );
foreach ( $caps as $cap ) {
if ( self::VIEW_CAP === $cap ) {
foreach ( $roles as $role ) {
if ( self::_role_can_view_stream( $role ) ) {
$allcaps[ $cap ] = true;
break 2;
}
}
}
}
return $allcaps;
} |
While that seems like a workaround, that's what core is actually doing:
Risking situations where those two keys are modified inappropriately, would be the fault of whatever code that changes them ( like W3TC ). But what @kucrut is suggesting seems pretty valid to me ( not sure if it'd work though, haven't tested ). |
Out of curiosity, has anyone reported this to W3TC yet ? |
@shadyvb Not that we know of, I'll ask the OP. |
The OP has reported this to W3TC to get their feedback on the matter as well. |
A user reported in the forums that while running W3 Total Cache with the New Relic setting enabled the Stream Records page disappears.
I've isolated the problem to these lines in the W3TC plugin.
It seems that
$current_user->roles
is just an empty array when Stream is enabled.If you change the
VIEW_CAP
constant tomanage_options
everything works perfectly fine. So something about the way Stream is using a custom capability might be causing a conflict here, but I haven't been able to pinpoint exactly which plugin is to blame./cc @kucrut @shadyvb
The text was updated successfully, but these errors were encountered: