--- userprotect.module.OBS 2008-02-16 18:32:40.000000000 +0100 +++ userprotect.module 2008-12-12 10:07:14.000000000 +0100 @@ -1039,6 +1039,19 @@ function userprotect_get_user_protection $uid = $account->uid; $roles = $account->roles; + // Grab the role protections if they haven't already been initialized. + + if (!isset($role_protections)) { + $role_protections = variable_get('userprotect_role_protections', array()); + } + // For each role, check to see if it's enabled for that protection. + // Return TRUE as soon as we find a protected role. + foreach ($roles as $rid => $role) { + if ($role_protections[$rid][$protection]) { + return TRUE; + } + } + // Users editing their own accounts have the permissions for e-mail // and password determined by the role-based setting in the userprotect // section at admin/user/access. This is done for consistency with the @@ -1070,19 +1083,6 @@ function userprotect_get_user_protection return $protections[$uid][$protection]; } - // Grab the role protections if they haven't already been initialized. - if (!isset($role_protections)) { - $role_protections = variable_get('userprotect_role_protections', array()); - } - - // For each role, check to see if it's enabled for that protection. - // Return TRUE as soon as we find a protected role. - foreach ($roles as $rid => $role) { - if ($role_protections[$rid][$protection]) { - return TRUE; - } - } - // No protection enabled. return FALSE; } \ No newline at end of file