Viewing 14 replies - 31 through 44 (of 44 total)
  • Iv got the same issue. Admins are fine. But lesser users get set to the my-account page.

    I have deactivated my plugins and tested and its definitely woocommerce coursing the issue.

    Do we have any news on a new update to fix this?

    Gem @white Rabit: Do you have any role plugins installed (like Members or User Roles and Capabilities)? If you don’t you could always try installing one, I used Members. I was having a problem with the author role and those users not being able to access the dashboard for their posts and pages. I navigated within the admin area to Users > Roles and enabled the author role to have “edit_posts”. Now if this is a lesser user than an author, I’m not sure it’s the best idea to go this route and someone else may have some different input. But, the above notes is how I fixed my issue with the author role.

    Thread Starter jturet

    (@jturet)

    I used User Role Editor to enable the edit_posts capability for the desired users. I use this in conjunction with Advanced Access Manager to limit access to back-end areas. This solves the “lesser user than an author” predicament stated above.

    That fixed it but its given my user all sorts of back end options. I will have to use another plugin to hide all of that.

    Thanks for your help.

    G

    Thread Starter jturet

    (@jturet)

    Ahh yes, I forgot to mention this. WP Admin UI Customize is extremely powerful and versatile. I love it!

    SOLVE
    In the class class-wc-admin-php of Woocommerce there is a method called prevent_admin_access that validates the user permission, also there is a filter you can use to make your own logic.

    woocommerce_prevent_admin_access

    So in your theme functions.php or your custom plugin add next code.

    add_filter('woocommerce_prevent_admin_access', 'check_admin_access');
    function check_admin_access( $redirect_to ) {
      $user = wp_get_current_user();
      if( is_array( $user->roles ) && in_array( 'mycustomrol', $user->roles ) ) {
        return false;
      }
      return true;
    }

    I worked for me.

    @duvanmonsa, this answer is gold, tks for share, this answer must be in stackoverflow

    Thread Starter jturet

    (@jturet)

    Kelplat wrote:

    SIMPLE SOLUTION FOR EVERYONE,
    Hello,
    There is a better way to resolve this issue without any coding.
    To overpass the issue please :
    1/ type the urladdress https://www.yoursite.com/wp-admin/index.php instead of https://www.yoursite.com/wp-admin
    2/ Go in Woocommerce in the woocommerce settings in the page Tools.
    3/ Reset the permissions by clicking on the button reset the permissions.
    4/ Problem solved
    Kind regards
    Samir

    YOURDOMAIN.COM/wp-admin/admin.php?page=wc-status&tab=tools

    Or disable the redirect with this.

    function custom_r($prevent_access){
    $prevent_access = '';
    return $prevent_access;
    }
    
    add_filter("woocommerce_prevent_admin_access","custom_r");

    Thanks LondonThemes your solution worked ??

    Thanks LondonThemes, that solution worked for me too!!!!! ??

    Using Members plugin as well and granted permission edit_posts per @girdy74’s suggestion and it works now for me too!

    Advisory

    (@advisory)

    London themes – spot on! Thank you, been trying to fix this all day.

Viewing 14 replies - 31 through 44 (of 44 total)
  • The topic ‘Update causes wp-admin redirect to my-account’ is closed to new replies.