function user_user_presave

user_user_presave(&$edit, $account, $category)

Implements hook_user_presave().

File

modules/user/user.module, line 1302
Enables the user registration and login system.

Code

function user_user_presave(&$edit, $account, $category) {
  if ($category == 'account' || $category == 'register') {
    if (!empty($edit['picture_upload'])) {
      $edit['picture'] = $edit['picture_upload'];
    }
    // Delete picture if requested, and if no replacement picture was given.
    elseif (!empty($edit['picture_delete'])) {
      $edit['picture'] = NULL;
    }
  }

  // Filter out roles with empty values to avoid granting extra roles when
  // processing custom form submissions.
  if (isset($edit['roles'])) {
    $edit['roles'] = array_filter($edit['roles']);
  }

  // Move account cancellation information into $user->data.
  foreach (array('user_cancel_method', 'user_cancel_notify') as $key) {
    if (isset($edit[$key])) {
      $edit['data'][$key] = $edit[$key];
    }
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!user!user.module/function/user_user_presave/7.x