You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wonder why you chose to use current_user_can( 'administrator' ), this will only work if the user role is named administrator. In case you create custom roles or rename the given ones, the function will no longer return true. Without testing it, I expect it to already fail for the super_administrator role in a network.
If you have a very specific reason for testing for 'administrator' I propose to add a filter, to be able to customize the capability.
Or replace 'administrator' with 'manage_options'.
I'll be happy to provide a PR, if you just give me your preferred solution.
For reference:
The role name capabilities are set in these two function with the following line.
This particular function has_required_privileges() is used in several places where it is about someone that you dedicate as the main user. This is derived from the idea that currently it is somewhat assumed that one person uses the blog (although this might change at some point, see #285) and you can select that user in the friend settings. The Administrator here is just a fallback that I am not sure is actually ever reached.
Hey Alex,
friends/includes/class-friends.php
Line 670 in a36317d
I wonder why you chose to use
current_user_can( 'administrator' )
, this will only work if the user role is namedadministrator
. In case you create custom roles or rename the given ones, the function will no longer return true. Without testing it, I expect it to already fail for thesuper_administrator
role in a network.If you have a very specific reason for testing for 'administrator' I propose to add a filter, to be able to customize the capability.
Or replace 'administrator' with 'manage_options'.
I'll be happy to provide a PR, if you just give me your preferred solution.
For reference:
The role name capabilities are set in these two function with the following line.
$this->caps[ $role ] = true;
The text was updated successfully, but these errors were encountered: