Forum Replies Created
-
AuthorPosts
-
Vladimir
KeymasterHi,
This code removes all HTML tags from the post content before save it for all users with ‘author’ role:
add_filter('content_save_pre', 'nohtml_in_posts');function nohtml_in_posts($content) {
if (current_user_can('author')) {
$content = wp_filter_nohtml_kses($content);
}return $content;
}
Include it into active theme’s functions.php file.Vladimir
KeymasterHi, this plugin does not introduce its own capabilities. It uses built-in WordPress
manage_options
user capability for its menu item:
https://storage.googleapis.com/role-editor/downloads/support/si-contact-form-capability.pngYou may find user capability for any admin menu item with a help of “Admin access add-on”:
https://www.role-editor.com/block-admin-menu-items
Just open it for the Administrator role and find needed menu item in the list.Vladimir
KeymasterThanks for the information.
Could you tell me from what plugin that custom menu is, so I may directly test URE with it?As about “Block not selected” option, it works currently as straightforward as it named – blocked (as result user is redirected) all not selected URLs. So if some link is clicked from the allowed page, but that link was not selected at menu items list (it may even be not presented there) user will not get access to it.
Vladimir
KeymasterHi,
Thanks. I found an issue in URE with your help:
Other default roles (in addition to the primary role) was assigned to a new registered user for requests from the admin back-end only. Now this feature works for the requests from the front-end user registration forms too.Try next update: development version 4.19.1.b2. It should work as expected now.
Vladimir
KeymasterIn order to edit published page, user should have ‘edit_published_pages’ capability. I added it directly to the user. checkman-test may edit allowed page now.
Vladimir
KeymasterHi,
OK. Thanks for letting me know, that you find an answer yourself.
Vladimir
KeymasterIs it possible to look on that data online? Send admin credentials to the [email protected]
Vladimir
KeymasterIf that post is from other author, then user should have ‘edit_others_posts’ capability to get permission to edit it.
Vladimir
KeymasterThanks for the information. It’s a strange effect. Roles editing core was not changed. So I can not repeat and explain it.
Vladimir
KeymasterTry this variant:
add_filter('woocommerce_disable_admin_bar', '_wc_disable_admin_bar', 10, 1); function _wc_disable_admin_bar($prevent_admin_access) { if ( !( current_user_can('data_entry') || current_user_can('operator') || current_user_can('manager') ) ) { return $prevent_admin_access; } return false; } add_filter('woocommerce_prevent_admin_access', '_wc_prevent_admin_access', 10, 1); function _wc_prevent_admin_access($prevent_admin_access) { if ( !( current_user_can('data_entry') || current_user_can('operator') || current_user_can('manager') ) ) { return $prevent_admin_access; } return false; }
Vladimir
KeymasterGood. Thanks for the information.
You may use one complex expression for all roles, like this one:
if (!(current_user_can('role1') || current_user_can('role2'))) { return .... }
Vladimir
KeymasterIt seems I found a problem with code. Replace ‘no’ to ‘false’. It should help.
add_filter('woocommerce_disable_admin_bar', '_wc_disable_admin_bar', 10, 1); function _wc_disable_admin_bar($prevent_admin_access) { return false; }
Vladimir
KeymasterOk. I will re-test this code myself.
Vladimir
KeymasterWhile it worked for me as it is, try to add filter with lower priority value – 9 instead of 10.
Vladimir
KeymasterDeactivate all plugins except WooCommerce and try. If that will help activate plugins back one by one. May be something else takes an effect.
-
AuthorPosts