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

  1. Write a patch
  2. Review
  3. Commit

User interface changes

None.

API changes

None.

Data model changes

None.

CommentFileSizeAuthor
#2 3070020-2.patch998 bytesidebr

Comments

idebr created an issue. See original summary.

idebr’s picture

Title: role_watchdog_user_presave() generates a notice when an account is registered through » role_watchdog_user_presave() generates a notice when an account is registered through user_external_login_register()
Status: Active » Needs review
StatusFileSize
new998 bytes

Attached patch checks if $account->status is available in role_watchdog_user_presave() before calling role_watchdog_user_block()

  • gaurav.kapoor committed 2abd66d on 7.x-2.x authored by idebr
    Issue #3070020 by idebr: role_watchdog_user_presave() generates a notice...
gaurav.kapoor’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.