function user_role_load_by_name

Fetches a user role by role name.

Parameters

$role_name: A string representing the role name.

Return value

A fully-loaded role object if a role with the given name exists, or FALSE otherwise.

See also

user_role_load()

3 calls to user_role_load_by_name()
UserRoleAdminTestCase::testRoleAdministration in drupal-7.x/modules/user/user.test
Test adding, renaming and deleting roles.
user_admin_role_validate in drupal-7.x/modules/user/user.admin.inc
Form validation handler for the user_admin_role() form.
user_role_delete in drupal-7.x/modules/user/user.module
Delete a user role from database.

Archivo

drupal-7.x/modules/user/user.module, line 2935
Enables the user registration and login system.

Código

function user_role_load_by_name($role_name) {
  return db_select('role', 'r')->fields('r')->condition('name', $role_name)->execute()->fetchObject();
}