Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Contributor Mike Jolley

    (@mikejolley)

    add_filter( 'woocommerce_prevent_admin_access', '__return_false' );

    Add to theme functions.php

    Thread Starter Sadegh Hosseini

    (@mr-seven)

    Thanks for help.
    But I think with this code every users of my website can access to admin area. but I don’t want my Amateur users know that I’m using WordPress.
    All I want is users with permissions can go to admin panel.

    Plugin Contributor Mike Jolley

    (@mikejolley)

    Uses who can manage_woocommerce or edit_posts are allowed through by default.

    Thread Starter Sadegh Hosseini

    (@mr-seven)

    This is my problem:
    Users with rules like shop_manager or editor (both have manage_woocommerce and/or edit_posts permission) can’t access admin area.

    Plugin Contributor Mike Jolley

    (@mikejolley)

    The above snippet should not be needed then. Can you try the above, it it does not let them in after that the problem may be elsewhere.

    Thread Starter Sadegh Hosseini

    (@mr-seven)

    I’ve added that code inside my theme’s “functions.php” but it doesn’t work.
    I try to login with a user with shop_manager role and I can’t go to admin panel.

    Plugin Contributor Mike Jolley

    (@mikejolley)

    In that case its not being blocked by WooCommerce itself. Thats the only code we have which blocks access.

    Rule out theme and other plugins.

    Same issue…
    I have a custom Role (Employee) using Members (justin tadlock) plugin that are allowed to access their profile.php page with permissions like edit_employees, publish_employees

    I added

    add_filter( 'woocommerce_prevent_admin_access', '__return_false' );
    

    which prevents My account redirect but now just gives a white screen for Employees that login and want to look at profile.php. They can see the dashboard and the link to Profile.

    Any further insight on this and custom roles? or a way to omit my account altogether?

    Update to above.
    Went the deactivate route.

    Deactivated Woocommerce and things worked as normal.
    Reactivated Woocommerce profile.php white screen

    Started deactivating other plugins in order.
    Deactivated Adminimize … profile.php is accessable

    So Woo and the above filter plus Adminimize is the issue, for now it seems.
    Although not sure how yet as the Employee role in Adminimize didn;t have any profile stuff deactivated…

    Plugin Contributor Mike Jolley

    (@mikejolley)

    “woocommerce_prevent_admin_access” is all we need to stop the redirect. I cannot see anything else in core which would white screen profile.

    I think it was a plugin cocktail of things… they had Adminimize, Members, 2 photo and video plugins that were no longer actively developed.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘My roles (except admin) can't access admin area’ is closed to new replies.