LLMS_Abstract_Generator_Posts::authorize_new_user_role( string $role )
Ensure the current user is allowed to assign a role to a user created during import
Parameters Parameters
- $role
-
(string) (Required) WP_User role to be assigned to the new user.
Return Return
(WP_Error|true) Returns true when the role may be assigned or a WP_Error when it may not.
Source Source
File: includes/abstracts/llms-abstract-generator-posts.php
protected function authorize_new_user_role( $role ) {
// Load admin functions to get access to `get_editable_roles()`.
require_once ABSPATH . 'wp-admin/includes/admin.php';
$editable_roles = get_editable_roles();
if ( empty( $editable_roles[ $role ] ) ) {
return new WP_Error(
'llms-generator-unauthorized-role',
__( 'You are not allowed to create a user with the requested role.', 'lifterlms' )
);
}
return true;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 10.0.8 | Introduced. |