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

[BUGFIXING] Users with editor Role can't restrict content from sideba… #3238

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions includes/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ function pmpro_rest_api_get_permissions_check( $request ) {
'/pmpro/v1/me' => true,
'/pmpro/v1/recent_memberships' => 'pmpro_edit_members',
'/pmpro/v1/recent_orders' => 'pmpro_orders',
'/pmpro/v1/post_restrictions' => 'pmpro_edit_members',
'/pmpro/v1/post_restrictions' => 'edit_others_posts',
);
$route_caps = apply_filters( 'pmpro_rest_api_route_capabilities', $route_caps, $request );

Expand All @@ -1209,8 +1209,8 @@ function pmpro_rest_api_get_permissions_check( $request ) {
// No permission for this method, default to false.
$permission_to_check = false;
} else {
// Same permission for all methods, use it.
$permission_to_check = $route_caps[$route];
// If it's a boolean return it if it's a string ask if user can
$permission_to_check = $route_caps[$route] || current_user_can( $route_caps[$route] );
}

// Check the permission.
Expand Down