WP_REST_Comments_Controller::check_assign_author_permission
Checks whether the current user can attribute a comment to another user.
Method of the class: WP_REST_Comments_Controller{}
No Hooks.
Returns
bool. Whether the comment can be attributed to the user.
Usage
// protected - for code of main (parent) or child class $result = $this->check_assign_author_permission( $author_id );
- $author_id(int) (required)
- ID of the user the comment is being attributed to.
Changelog
| Since 7.1.5 | Introduced. |
WP_REST_Comments_Controller::check_assign_author_permission() WP REST Comments Controller::check assign author permission code WP 7.1.5
protected function check_assign_author_permission( $author_id ) {
return current_user_can( 'moderate_comments' ) && is_user_member_of_blog( $author_id );
}