Forum Replies Created
- 
		AuthorPosts
- 
		
			
				
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.Vladimir KeymasterArie, Perfect. Now, I reproduced a PHP error trying to open restricted pages list having active “ACF Better Search” plugin. I will work on a workaround. Vladimir KeymasterArie, Thanks for the information. I just wanted to recommend you, if you have some unused plugins activated try to deactivate them. It will free some memory and may resolve an issue. Before I will start tests with “ACF: Better Search”, what if to deactivate some other plugin(s), but leave ACF BS active instead? Will error 500 problem stay or go away? I Vladimir KeymasterHi Arie, Right, it’s not the permissions issue. You will see ‘Not enough permissions’ or similar error message in that case. HTTP 500 error code is a server side error. The most probable reason is a script execution timeout or ‘not enough memory’ issue. It will be good if you can look at the server system logs for the related error message. Do you have a huge quantity of posts at your site? Vladimir KeymasterTo @kmeronuk, You came to a right conclusion. I added new paragraph to admin menu documentation page. It explains a reason and includes a workaround. Vladimir KeymasterUser Role Editor does not make any special efforts on custom user capabilites created by other plugins. ‘gravity_forms_addonname_uninstall’ user capability is registered by active Gravity Forms add-on and should be used by Gravity Forms or/and related GF add-on. URE helps you to add such custom user capability to a role by your selection. URE saves capability with role together in the database when you turn it on for a role. That’s it. I made a quick search through the GF code and one of GF add-on I have. It seems, on the 1st glance, that this capability ‘gravity_forms_addonname_uninstall’ is never used. Vladimir KeymasterHi Michael, I’m sorry about so huge delay with response. I missed you question somehow. User Role Editor just modifies role here (according to your description) and nothing more. GF plugin itself should check a capability and prohibit not allowed actions. It’s better to address this question to Gravity Forms support 1st. Vladimir Keymaster1st, $user_role and $user variables are not defined in these code lines: if ( $user_role == ‘customer’ ) { $user->remove_role( ‘new-web’ );You should start from getting current user: $user = wp_get_current_user(); if(!$user) { return; }Then check if current user is not administrator. 
 Then make manipulations with user role.
 If you use $user->add_role(), $user->remove_role(), there is no need to use wp_update_user().
- 
		AuthorPosts
