darrenjacoby / intervention

WordPress plugin to configure wp-admin and application state using a single config file.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

all-not-administrator with multiple roles

tablufc88 opened this issue · comments

I've created a membership style site so each user has multiple roles depending on whether they are signed up.

Not got too far with the setup, but when trying to set options separately using all-not-administrator it has no effect. Guessing this is due to the multiple roles. Is there a way around this?

E.g. With the following, I can't see any updates when logged in as admin.

'wp-admin.all' => [ 'common.adminbar.wp' ], 'wp-admin.all-not-administrator' => [ 'common.updates' ]

Hi @tablufc88 ,

What plugin are you using (if any) to implement multiple user roles? I would like to re-create my side to test and see if I can find a viable solution.

Hey @darrenjacoby,

Not using a plugin, just using Stripe to assign roles based on subscription type with $user->add_role( $siteRole );$user->add_role( $planRole );

It seems that you can assign multiple roles using this plugin - https://en-au.wordpress.org/plugins/user-role-editor/

OK cool, will test with $user->add_role(), just wanted to make sure that was the route you were taking!

Hi @tablufc88 ,

Tested this with the plugin above, and it seems to work as should.

E.g. With the following, I can't see any updates when logged in as admin.

'wp-admin.all' => [ 'common.adminbar.wp' ], 'wp-admin.all-not-administrator' => [ 'common.updates' ]

This sounds correct though. Any user role with an administrator user role won't have common.updates removed, as it applies to all user roles excluding the administrator role.

Let me know if I'm understanding the above correctly.

Found the issue. I had assigned another role to admin for debugging. When I removed it, intervention works as it should like you say.

My bad! I guess this wouldn't happen too often, so it's probably nothing to worry about.