Forum Replies Created
-
AuthorPosts
-
VladimirKeymaster
Compare if you have the same choice for “the Settings->User Role Editor->Additional Modules” ->”Force custom post types to use their own capabilities” option at all 3 different sites.
VladimirKeymasterHi,
Is CBD plugin network activated?
Or do you activate it for every site separately?VladimirKeymasterHi,
Look at this add-on:
https://www.role-editor.com/block-admin-menu-itemsVladimirKeymasterTry grant to a role the deprecated ‘level_1’ capability, and ‘manage_options’ capability, in addition to all capabilities, started from ‘rank_math_’.
VladimirKeymasterThanks for the clarification. I just returned to office. Let me make some tests with this app.
VladimirKeymasterEdit restrictions should work if app uses WordPress built-in WPQuery to extract data from the database. I see few different plugins which offers to built WP app for WordPress site. Which one do you use?
VladimirKeymaster“Tools->WP Mail Log” menu item is protected by ‘manage_options’ user capability.
VladimirKeymasterHi,
Is “WP Mail logging” available at wordpress.org/plugins? If Yes, send the link.
VladimirKeymasterThis problem is not related directly to the user permissions. But comes from how WordPress checks if user has access to the an admin page. WP checks if user has access to the admin menu item correspondent to the admin page, but if it’s not defined shows the access error message event if user has full access to this custom post type.
at the end of wp-admin/includes/menu.php:if ( ! user_can_access_admin_page() ) { /** * Fires when access to an admin page is denied. * * @since 2.5.0 */ do_action( 'admin_page_access_denied' ); wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); } $menu = add_menu_classes( $menu );
You can find function
user_can_access_admin_page()
at wp-admin/includes/plugin.php file and look how many criteria WP checks for admin page access, not only related user capability.You need to investigate how correctly define admin menu to show custom post type from there, not from the default WP menu for CPT. May be look to some other plugin code, which make something similar.
VladimirKeymasterYes, follow this article:
VladimirKeymasterHello Valentin,
Is it possible to get access with admin credentials to your site (it would be a stage copy without critical data), from which I can take a copy of database, plugins and themes folders using UpdraftPlus plugin? I need install it at own local development environment to search a reason of the issue and prepare the fix. I use such copies in the investigation purpose only and remove after finishing work with them.
VladimirKeymasterI think, this is more specific case than universal one, in order to add it as a feature to the plugin. So I do not plan make this.
VladimirKeymasterWC uses the same post type for the reviews – ‘product’. So we have to use additional code in order achieve your purpose. Working on you problem I found/fixed some bugs in the current version of URE Pro. So, download version 4.63.b1 from the “Downloads” page (login first).
1) Grant all product edit permissions to your role, test-role-1 in my example.
2) Block “Products” menu item for this role via “Admin Menu”.
3) Activate “Post/page edit restrictions” add-on: https://www.role-editor.com/allow-user-edit-selected-posts/
4) Set for user “Look at roles” at the “Posts/Pages/Custom Post Types Editor Restrictions” section.
5) Open “Post Edit” for your role and select “Prohibit” and “Products” post type.
6) Add code below to your active theme functions.php file or set up as a Must Use plugin:
add_filter('ure_restrict_edit_post_type', 'ure_edit_review_but_not_product', 10, 1 );
function ure_edit_review_but_not_product( $post_type ) {if ( $post_type!=='product') {
return $post_type;
}$user = wp_get_current_user();
if ( empty( $user ) || !in_array( 'test-role-1', $user->roles ) ) {
return $post_type;
}
if ( !isset( $_GET['page'] ) || $_GET['page']!='product-reviews' ) {
return $post_type;
}return false;
}
Replace ‘test-role-1’ above with your own role ID.As a result, user with full product edit permissions will can moderate reviews, but can not see/edit products at admin back-end.
VladimirKeymasterprnt.sc is not reachable for me. Did you add edit_products, edit_published_products, edit_others_products capabilities to make reviews editable for this role?
VladimirKeymasterHi,
As workaround grant for such role: read, view_admin_dashboard, moderate_comments and edit product capabilities. But block “Products”, “All Products” menu items via “Admin menu blocking” add-on:
https://www.role-editor.com/block-admin-menu-items -
AuthorPosts