<?phpfunction user_access($string, $account = NULL) { global $user;
if (!isset($account)) { $account = $user; }
// User #1 has all privileges: if ($account->uid == 1) { return TRUE; }
// To reduce the number of SQL queries, we cache the user's permissions // in a static variable. // Use the advanced drupal_static() pattern, since this is called very often. static $drupal_static_fast; if (!isset($drupal_static_fast)) { $drupal_static_fast['perm'] = &drupal_static(__FUNCTION__); } $perm = &$drupal_static_fast['perm']; if (!isset($perm[$account->uid])) { $role_permissions = user_role_permissions($account->roles);
/** * Checks for usernames blocked by user administration. * * @param $name * A string containing a name of the user. * * @return * Object with property 'name' (the user name), if the user is blocked; * FALSE if the user is not blocked. */?>
Комментарии
Функцию укажите...
<?phpfunction user_access($string, $account = NULL) {
global $user;
if (!isset($account)) {
$account = $user;
}
// User #1 has all privileges:
if ($account->uid == 1) {
return TRUE;
}
// To reduce the number of SQL queries, we cache the user's permissions
// in a static variable.
// Use the advanced drupal_static() pattern, since this is called very often.
static $drupal_static_fast;
if (!isset($drupal_static_fast)) {
$drupal_static_fast['perm'] = &drupal_static(__FUNCTION__);
}
$perm = &$drupal_static_fast['perm'];
if (!isset($perm[$account->uid])) {
$role_permissions = user_role_permissions($account->roles);
$perms = array();
foreach ($role_permissions as $one_role) {
$perms += $one_role;
}
$perm[$account->uid] = $perms;
}
return isset($perm[$account->uid][$string]);
}
/**
* Checks for usernames blocked by user administration.
*
* @param $name
* A string containing a name of the user.
*
* @return
* Object with property 'name' (the user name), if the user is blocked;
* FALSE if the user is not blocked.
*/?>
и если делаю print $account->uid; выводит 1
$account прилетел как не-объект. Включите devel, поставьте там показ ошибок как крумо. Она вам покажет кто вызвал так.
if (isset($account->uid) && $account->uid == 1) {
return TRUE;
}
А вот менять сурсы не советую, лучше разобраться в проблеме...