Forum Replies Created
-
AuthorPosts
-
VladimirKeymaster
Edit 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-itemsVladimirKeymasterHi,
I see the only way to solve this task – create 2 roles:
1) create, modify and delete all articles and create, edit, delete pages only;
2) edit specific pages from other users according restriction by its ID.
Grant those role to different WP users. When someone need to work with role 1 he logins with user 1, when with role 2 – he re-logins with user 2.Is this workaround applicable for in your case?
24/08/2022 at 04:16 in reply to: How to restrict the user role “Author” from viewing “Comments”? #8024VladimirKeymasterHi,
You can block ‘Comments’ menu for Author role using “Admin menu access” add-on:
https://www.role-editor.com/block-admin-menu-items19/08/2022 at 14:37 in reply to: How to add capability for Meta Tag Manager for non-admin user role #8018VladimirKeymasterHi,
Grant ‘list_users’ capability to this user role.
VladimirKeymasterHi,
Is it Gravity Forms add-on?
Can you share this plugin .zip via Google Drive, DropBox or similar for the investigaion?VladimirKeymasterHi,
It’s better to deactivate plugin at the older place before activate it at a new one.
Btw., license key is important only for access to the automatic updates. Plugin does not block/hide itself due to license state.Try login as a user with WP built-in administrator role. URE makes itself available for this role automatically. If you don’t see URE as such user, try to deactivate URE and activate it back. If it’s not visible at the “Plugins” page make this via FTP:
– rename user-role-editor-pro folder to user-role-editor-pro-1;
– open ‘Plugins’ page again. WP will automatically deactivate URE, is its files are not available;
– rename URE folder back to user-role-editor-pro;
– return to “Plugins” page and activate URE again.
URE tries to grant its user capabilities to administrator role on activation. -
AuthorPosts