Forum Replies Created
-
AuthorPosts
-
15/05/2018 at 03:15 in reply to: Activate Front End Menu Access module not working on my theme #4843
Vladimir
KeymasterHi,
Edit file edit_mega_menu_walker.php, insert
do_action( 'wp_nav_menu_item_custom_fields', $item_id, $item, $depth, $args );at the line #467, just after the ‘description’ field paragraph, like this:
<p class="field-move hide-if-no-js description description-wide"> ... </p> <?php do_action( 'wp_nav_menu_item_custom_fields', $item_id, $item, $depth, $args ); ?>I hope it will help. In case of failure, I will need access to a full theme copy, to make own tests.
Vladimir
KeymasterUrs,
“Network Admin->Users->User Role Editor->Update Network” makes exactly this:
1) replicate roles from main site to all subsites;
2) replicate selected add-ons data to all subsites.Vladimir
KeymasterHi Urs,
Yes, I assume that you will configure this add-on via custom code (functions.php or MU plugin) at this stage. I will add a user interface to this part later.
03/05/2018 at 09:00 in reply to: Limit user to changing a single page & add events through multiple plugins #4828Vladimir
KeymasterYes, code was modified correctly.
03/05/2018 at 07:55 in reply to: Limit user to changing a single page & add events through multiple plugins #4826Vladimir
KeymasterThat is you should have this code in your functions.php finally:
// User role editor pro - Show all attachments for all roles add_filter('ure_attachments_show_full_list', 'show_full_list_of_attachments', 10, 1); function show_full_list_of_attachments($show_all) { //if (!current_user_can('hetbakenbeheren' or 'jaarboekje' or 'kerkdienstplanning')) { $current_user = wp_get_current_user(); if (!in_array('hetbakenbeheren', $current_user->roles) && !in_array('jaarboekje', $current_user->roles) && !in_array('kerkdienstplanning', $current_user->roles)) { return $show_all; } return true; } // ure_restrict_edit_post_type add_filter('ure_restrict_edit_post_type', 'exclude_posts_from_edit_restrictions'); function exclude_posts_from_edit_restrictions($post_type) { $restrict_it = true; $current_user = wp_get_current_user(); if (in_array($post_type, array('event', 'ctc_event'))) { if (in_array('hetbakenbeheren', $current_user->roles) && in_array('kerkdienstplanning', $current_user->roles)) { $restrict_it = false; } } elseif ($post_type=='ctc_sermon') { if (in_array('dominee', $current_user->roles)) { $restrict_it = false; } } return $restrict_it; }03/05/2018 at 07:54 in reply to: Limit user to changing a single page & add events through multiple plugins #4825Vladimir
Keymaster2)
You have to insert this line of code:add_filter('ure_restrict_edit_post_type', 'exclude_posts_from_edit_restrictions');just before
function exclude_posts_from_edit_restrictions($post_type) {line in order this post types exclusion works. It does not work at all currently.
Let me know the result.
03/05/2018 at 07:51 in reply to: Limit user to changing a single page & add events through multiple plugins #4824Vladimir
KeymasterGot it.
Check your child theme functions.php file.1)
Line #174 will never work:if (!current_user_can('hetbakenbeheren' or 'jaarboekje' or 'kerkdienstplanning')) {as such role this expression “‘hetbakenbeheren’ or ‘jaarboekje’ or ‘kerkdienstplanning'” is evaluated to a boolean result, but current_user_can() function wait that its argument will be a string with a role ID.
You have to use this code:function show_full_list_of_attachments($show_all) { //if (!current_user_can('hetbakenbeheren' or 'jaarboekje' or 'kerkdienstplanning')) { $current_user = wp_get_current_user(); if (!in_array('hetbakenbeheren', $current_user->roles) && !in_array('jaarboekje', $current_user->roles) && !in_array('kerkdienstplanning', $current_user->roles)) { return $show_all; } return true; }In order users with one of those 3 roles see full list of attachments, but any other restricted user will still see just his own attachments in the Media Library.
Vladimir
KeymasterHi,
Try this variant:
/** * Redirect to the home page all users except administrator after successful login. * * @param string $redirect_to URL to redirect to. * @param string $request URL the user is coming from. * @param object $user Logged user's data. * @return string */ function my_login_redirect( $redirect_to, $request, $user ) { //is there a user to check? if (isset($user->roles) && is_array($user->roles)) { //check for subscribers if (!in_array('administrator', $user->roles)) { // redirect them to another URL, in this case, the homepage $redirect_to = home_url(); } } return $redirect_to; } add_filter( 'login_redirect', 'my_login_redirect', 10, 3 );Vladimir
KeymasterHi,
I can look on this issue at your site if you send admin credentials and this problematic user name to support [at-sign] role-editor.com
03/05/2018 at 02:16 in reply to: Limit user to changing a single page & add events through multiple plugins #4818Vladimir
KeymasterCan you provide me access to this site database and theme+plugins files copy (via DropBox or similar)?
I will setup a copy of your site at my local development environment and check what is going wrong.Or just provide me admin access to your site or its stage/development copy and I will get needed files/data myself (support [at-sign] role-editor.com).
02/05/2018 at 03:35 in reply to: Limit user to changing a single page & add events through multiple plugins #4814Vladimir
KeymasterHi Arie,
Multiple functions on the same filter returns different results for the same custom post type as filter function does not take a result of a previously called code.
I recommend to use a single function for this filter with a logic for all you cases. Try this variant:
function exclude_posts_from_edit_restrictions($post_type) { $restrict_it = true; $current_user = wp_get_current_user(); if (in_array($post_type, array('event', 'ctc_event'))) { if (in_array('hetbakenbeheren', $current_user->roles) && in_array('kerkdienstplanning', $current_user->roles)) { $restrict_it = false; } } elseif ($post_type=='ctc_sermon') { if (in_array('dominee', $current_user->roles)) { $restrict_it = false; } } return $restrict_it; }It does not restrict ‘event’ and ‘ctc_event’ CPT for a user who has both ‘hetbakenbeheren’ and ‘kerkdienstplanning’ roles at the same time.
It does not restrict ‘ctc_sermon’ CPT if user has ‘dominee’ role.Vladimir
KeymasterHi @wp.network,
Thanks for this remind and definitely useful suggestions. No these features are still not realized. I confirm that I will work on them this year.
26/04/2018 at 16:10 in reply to: Limit user to changing a single page & add events through multiple plugins #4805Vladimir
KeymasterHi Arie,
Code for user with 2 roles to exclude from the edit restrictions 2 mentioned custom post types may be similar to:add_filter('ure_restrict_edit_post_type', 'exclude_posts_from_edit_restrictions'); function exclude_posts_from_edit_restrictions($post_type) { $restrict_it = true; $current_user = wp_get_current_user(); if (!in_array('hetbakenbeheer', $current_user->roles) || !in_array('kerkdienstplanning', $current_user->roles)) { return $restrict_it; } $do_not_restrict = array('event', 'ctc-event'); if (in_array($post_type, $do_not_restrict)) { $restrict_it = false; } return $restrict_it; }Vladimir
KeymasterArie,
Thanks for the help with isolating this conflict between 2 plugins.
Vladimir
KeymasterCan you please test development version 4.45.b2?
It’s available after login from the same Download” page. -
AuthorPosts