• is the Access plugin interfering in any way with wordpress native functions such as current_user_can() and is_admin()?
• is the Access plugin interfering in any way with wordpress default roles and capabilities definition?
My problem is: the two functions below work OK when Access is not activated and current_user_can( 'edit_posts' ) returns the right value. As soon as I activate Toolset Access, current_user_can('edit_posts') returns false and, as a result of the two functions below, I have no top admin bar nor access to wp-admin when logged in as a user with an Author role.
I have defined three new level_0 roles in Access but I have no other control options set.
I have two functions in my theme to:
1/ restrict access to wp-admin depending on user capabilities:
This does suggest that Toolset Access interferes with current_user_can when using a capability as parameter. Is this by design? If so, this may cause issues with a number of plugins and code snippets out there ...
Thanks for this. This is really strange behaviour then.
As mentionned, the only thing I've done in toolset Access is to create three level 0 roles. I haven't set any other access restrictions / role permissions. The level 2 / Author role has edit_posts enabled. Please note I do not seem to be able to edt the capabilities for WordPress roles and permission levels via Access
NB: operating all latest versions of wordpress and the toolset suite.
I'm using permission levels instead of capabilities as noted in message #418463 above, so not urgent - just wondering if you could shed light on this for future reference.
That is correct, Access does not allow you to edit the default wordpress roles.
Also when access is enabled it reads what level each role is based on capabilities. So instead of saying Authors can edit post, Create posts etc. It says Author is a level 2 role and level 2 roles can do the following. https://codex.wordpress.org/User_Levels#User_Level_2
So using permission levels would be best to gain basic roles of that level pre-enabled and then you can add additional responsibilities to your custom role.
I understand your point. My only concern is that I've seen lots of plugins and themes using the following function with the capability as a parameter, and from my testing, it seems that activating Access results in this function returning false when it should return true. If this is the case, then it would potentially trigger compatibility issues between Access and third party thems or plugins.
current_user_can('edit_posts');
I am marking this as resolved but it may be worth for your development team to test this behaviour and assess any potential compatibility issues.
Best wishes and thanks again for your response.
Manu
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.