Forum Replies Created
-
AuthorPosts
-
Vladimir
KeymasterThis post will help:
https://www.role-editor.com/woocommerce-admin-bar-access/Vladimir
KeymasterThanks. It seems to be correct.
Please check, if your child theme is really active.
Do you use WooCommerce plugin?Vladimir
KeymasterShow the code after modification.
Vladimir
KeymasterHi,
This code shows admin top menu bar for the role:
add_action('wp_head', 'show_top_admin_menu_bar', 100); function show_top_admin_menu_bar() { if (current_user_can('some_role')) { show_admin_bar(true); } }
Pay attention for the 100 value of a priority parameter. With this value code should be executed after that other plugin did its work.
You may add it to the functions.php file of your active theme.
Vladimir
KeymasterInteresting issue.
Is it possible to look on the issue on-line?
If “Yes”, send super-admin login credentials to the [email protected]Vladimir
KeymasterI provide support via forum or email only.
Is it possible to get your theme or plugin copy with step by step instruction how to repeat an issue? If “yes” send the installation package to support [at-sign] role-editor.com
I will use it at localhost for the testing purpose only.Vladimir
KeymasterJust tested URE Pro with all add-ons activated together with my own plugin, which uses front-end calls to WordPress AJAX.
It’s built according to this doc. page:
https://codex.wordpress.org/AJAX_in_Plugins
It works fine as for logged-in, as for non-logged-in users.So I need more information to repeat an issue.
If your functionality is included into the theme or plugin, is it possible to get it for the testing?Vladimir
KeymasterLet me know what checkboxes are turned on at the your site Settings->User Role Editor -> Additional Modules tab?
Vladimir
KeymasterHi,
Development version 4.19.b20 contains this functionality now. It is available from the download page after login.
Please test. The feedback is very appreciated.Vladimir
KeymasterIt is possible to set posts/pages edit restrictions for selected users:
https://www.role-editor.com/allow-user-edit-selected-posts/
Plugin still does not support such restrictions for the roles.You may insert the provided code into your active theme functions.php file.
Vladimir
KeymasterExcellent! Thanks for the feedback.
Vladimir
KeymasterHi,
I agree with you. I will try to add secondary roles multiselect list to the new user creation page to the next version of URE.
Vladimir
KeymasterOpen “Admin Menu” for the “Administrator” role, as it should have access to the full menu. Check what capability is really used to protect those standard menu items for the custom post types.
Vladimir
KeymasterCode:
// prefill roles at User profile editor Gravity Form fields add_filter( 'gform_pre_render_10', 'frontend_profile_populate_roles' ); function frontend_profile_populate_roles( $form ) { foreach ( $form['fields'] as &$field ) { if ( $field->type == 'select' && $field->inputName==='primary_role' ) { prepare_primary_role_dropdown($field); } if ( $field->type == 'multiselect' && $field->inputName==='secondary_roles' ) { prepare_secondary_roles_multiselect($field); } } // foreach return $form; } function get_primary_role() { global $current_user; if (!empty($current_user->roles)) { $roles = array_values($current_user->roles); $primary_role = array_shift($roles); } else { $primary_role = 'do-not-allow'; } return $primary_role; } function prepare_primary_role_dropdown( &$field ) { global $wp_roles; $primary_role = get_primary_role(); $choices = array(); foreach ($wp_roles->role_names as $key=>$value) { $is_selected = $primary_role===$key; $choices[] = array('text'=>$value, 'value'=>$key, 'isSelected'=>$is_selected, 'price'=>0.00); } $field->choices = $choices; } function prepare_secondary_roles_multiselect( &$field ) { global $current_user, $wp_roles; $primary_role = get_primary_role(); $choices = array(); foreach ($wp_roles->role_names as $key=>$value) { if ($key==$primary_role) { continue; } $is_selected = in_array($key, $current_user->roles); $choices[] = array('text'=>$value, 'value'=>$key, 'isSelected'=>$is_selected, 'price'=>0.00); } $field->choices = $choices; } // update user's roles according to the on form selection add_action( 'gform_user_updated', 'frontend_profile_change_user_roles', 10, 4); function frontend_profile_change_user_roles($user_id, $user_config, $entry, $user_pass) { $user = new WP_User($user_id); $user->set_role($entry[6]); // Primary role // secondary roles if (empty($entry[7])) { return; } $roles = explode(',', $entry[7]); foreach($roles as $role) { $user->add_role($role); } }
10 at the filter name ‘gform_pre_render_10’ is the ID of Gravity Forms form (with user profile fields including roles) linked to the “User Registration” add-on item with ‘update’ action.
Form ID=10 includes 2 roles related fields:
1) “Primary role” drop down field with “Allow field to be populated dynamically” flag turned on and “parameter name” value “primary_role”. It corresponds to the entry[6] at the code above.
2) “Secondary roles” multi select field with “Allow field to be populated dynamically” flag turned on and “parameter name” value “secondary_roles”. It corresponds to the entry[7] at the code above.Vladimir
KeymasterIn general, ‘upload_files’ is enough to see all items of the ‘Media Library’ and may add a new one.
I deactivated URE at your site temporally and ‘subscriber’ role still did not see Media Library items. This showed that some other plugin or even theme blocks access to the media library items. After some testing I discovered that your site current setup requires at least the ‘manage_options’ capability to be included into the ‘subscriber’ role in order it has access to media library items uploaded by others.
So I added ‘manage_options’ to the ‘subscriber’ role and blocked all extra menu items with ‘Admin menu’ add-on. Please check. -
AuthorPosts