Problem/Motivation
Drupal Core allows users to register through external services through user_external_login_register(). Role Watchdog then generates a notice:
Notice: Undefined property: stdClass::$status in role_watchdog_user_block()
Form the calling code in user_external_login_register():
$userinfo = array(
'name' => $name,
'pass' => user_password(),
'init' => $name,
'status' => 1,
'access' => REQUEST_TIME
);
$account = user_save(drupal_anonymous_user(), $userinfo);
where drupal_anonymous_user() returns:
$user = variable_get('drupal_anonymous_user_object', new stdClass);
$user->uid = 0;
$user->hostname = ip_address();
$user->roles = array();
$user->roles[DRUPAL_ANONYMOUS_RID] = 'anonymous user';
$user->cache = 0;
return $user;
Proposed resolution
Check if the 'status' property is set in both $account and $edit in role_watchdog_user_presave() before calling role_watchdog_user_block()
Remaining tasks
- Write a patch
- Review
- Commit
User interface changes
None.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3070020-2.patch | 998 bytes | idebr |
Comments
Comment #2
idebr commentedAttached patch checks if
$account->statusis available inrole_watchdog_user_presave()before callingrole_watchdog_user_block()Comment #4
gaurav.kapoor commented