Mike Jolley on "[Plugin: WooCommerce] My roles (except admin) can't access admin area"

ساخت وبلاگ

Sadegh Hosseini
Member
Posted 9 months ago #

Hi
My roles (except) can't access admin area.
they redirected to homepage of my site.
Will you help me please?

https://wordpress.org/plugins/woocommerce/

add_filter( 'woocommerce_prevent_admin_access', '__retu_false' );

Add to theme functions.php

Sadegh Hosseini
Member
Posted 9 months ago #

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.

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

Sadegh Hosseini
Member
Posted 9 months ago #

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.

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.

Sadegh Hosseini
Member
Posted 9 months ago #

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.

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.

Dallas Larsen
Member
Posted 2 hours ago #

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', '__retu_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?

Dallas Larsen
Member
Posted 49 minutes ago #

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

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

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 213 تاريخ : چهارشنبه 5 خرداد 1395 ساعت: 16:39