Backdrop now includes a User class, which extends Entity, and replacing all the CRUD relevant calls.
Drupal.org issue: https://drupal.org/node/1361228
Note that the Drupal issue removes user_save() entirely; in Backdrop user_save() remains as a wrapper around $user->save()
The $edit parameter was also removed.
Example implementations:
Creating and saving a user
Drupal 7:
$account = new stdClass();
$account->roles = array(DRUPAL_AUTHENTICATED_RID => 1);
$account = user_save($account, array('status' => 0));
Backdrop 1.0:
$account = entity_create('user', array());
$account->status = 0;
$account->roles = array(DRUPAL_AUTHENTICATED_RID => 1);
$account->save();
Manipulation of user object ($edit parameter removed):
Drupal 7:
$edit = array(
'user_cancel_method' => $form_state['values']['user_cancel_method'],
'user_cancel_notify' => $form_state['values']['user_cancel_notify'],
);
$account = user_save($account, $edit);
Backdrop 1.0:
$account->user_cancel_method = $form_state['values']['user_cancel_method'];
$account->user_cancel_notify = $form_state['values']['user_cancel_notify'];
$account->save();
User hooks now take a single argument for $account:
Drupal 7:
function hook_user_insert(&$edit, $account, $category) {
function hook_user_update(&$edit, $account, $category) {
function hook_user_presave(&$edit, $account, $category) {
Backdrop:
function hook_user_insert($account) {
function hook_user_update($account) {
function hook_user_presave($account) {
Note that in PHP 5, all objects are always passed by reference, so including an ampersand (`&`) in front of the `$account` variable is not necessary to modify the variable in `hook_user_presave()`. Other hooks such as `hook_user_login()` and `hook_user_cancel()` still have the same definitions as Drupal 7 and include the `$edit` parameters.