Forum Replies Created

Viewing 15 posts - 1,201 through 1,215 (of 2,522 total)
  • Author
    Posts
  • Vladimir
    Keymaster

    Hi,

    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 );
    
    in reply to: Permission issue with single user #4821
    Vladimir
    Keymaster

    Hi,

    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

    Vladimir
    Keymaster

    Can 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).

    Vladimir
    Keymaster

    Hi 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.

    in reply to: Rename a role does not cascade to subsites #4809
    Vladimir
    Keymaster

    Hi @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.

    Vladimir
    Keymaster

    Hi 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;
    }
    
    
    in reply to: Error 500 when using Post Edit Access #4802
    Vladimir
    Keymaster

    Arie,

    Thanks for the help with isolating this conflict between 2 plugins.

    in reply to: Error 500 when using Post Edit Access #4800
    Vladimir
    Keymaster

    Can you please test development version 4.45.b2?
    It’s available after login from the same Download” page.

    in reply to: Error 500 when using Post Edit Access #4798
    Vladimir
    Keymaster

    Arie,

    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.

    in reply to: Error 500 when using Post Edit Access #4796
    Vladimir
    Keymaster

    Arie,

    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

    in reply to: Error 500 when using Post Edit Access #4792
    Vladimir
    Keymaster

    Hi 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?

    in reply to: Search results not displaying #4789
    Vladimir
    Keymaster

    To @kmeronuk,

    You came to a right conclusion. I added new paragraph to admin menu documentation page. It explains a reason and includes a workaround.

    in reply to: GravitiyForms Addons Uninstall #4788
    Vladimir
    Keymaster

    User 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.

    in reply to: GravitiyForms Addons Uninstall #4785
    Vladimir
    Keymaster

    Hi 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.

    in reply to: Multiple roles help #4781
    Vladimir
    Keymaster

    1st, $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().

Viewing 15 posts - 1,201 through 1,215 (of 2,522 total)