Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
After programmatically create user I get error - "Notice: Undefined property: stdClass::$uid in htmlmail_user_presave() (line 179 of /sites/all/modules/htmlmail/htmlmail.module)."
Here is the code with which I created the user:
<?php
$new_user = array(
'name' => $form_state['values']['name'],
'pass' => $form_state['values']['pass'],
'mail' => $form_state['values']['email'],
'status' => 1,
'access' => REQUEST_TIME,
'roles' => array(
DRUPAL_AUTHENTICATED_RID => 'authenticated user',
// Customer role ID = 5.
5 => 'customer',
),
);
// Create user.
if (user_save(NULL, $new_user)) {
drupal_set_message("You have successfully register!");
}
else {
drupal_set_message("Registration error!", 'error');
}
?>
After that user successfully created with this error.
Comment | File | Size | Author |
---|---|---|---|
#6 | htmlmail-user-presave-undefined-property-2666086-6.patch | 616 bytes | jacob.embree |
|
Comments
Comment #2
hamrant CreditAttribution: hamrant at DEWEB Studio for Drupal Ukraine Community commentedMy minor fix.
Comment #4
jacob.embree CreditAttribution: jacob.embree at St. Louis Integration commentedComment #5
salvisThank you for the patches, hamrant and jacob.embree!
#4 has the correct format now, but you've added a trailing space:
Please remove it to conform to the Drupal Coding Guidelines.
Comment #6
jacob.embree CreditAttribution: jacob.embree at St. Louis Integration commentedComment #8
salvisThanks!