function user_role_load

Same name in other branches
  1. 8.9.x core/modules/user/user.module \user_role_load()

Fetches a user role by role ID.

Parameters

$rid: An integer representing the role ID.

Return value

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

See also

user_role_load_by_name()

2 calls to user_role_load()
UserRoleAdminTestCase::testRoleWeightChange in modules/user/user.test
Test user role weight change operation.
user_role_delete in modules/user/user.module
Delete a user role from database.

File

modules/user/user.module, line 3015

Code

function user_role_load($rid) {
    return db_select('role', 'r')->fields('r')
        ->condition('rid', $rid)
        ->execute()
        ->fetchObject();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.