You are here

function ulogin_user_presave in uLogin (advanced version) 7

Implements hook_user_presave().

File

./ulogin.module, line 124
Main file for the uLogin module.

Code

function ulogin_user_presave(&$edit, $account, $category) {
  global $ulogin_data;
  if (empty($account->uid) && !empty($ulogin_data)) {

    // the user is being created
    $edit['data']['ulogin'] = $ulogin_data;
    if (!empty($ulogin_data['email'])) {

      //email_confirm: if email was manually entered - set temporary email
      if (!empty($ulogin_data['manual']) && in_array('email', explode(',', $ulogin_data['manual'])) && variable_get('ulogin_email_confirm', 0) && module_exists('email_confirm')) {
        $edit['mail'] = preg_replace('/^(.+)@/', '$1+not_confirmed@', $ulogin_data['email']);
      }
      else {
        $edit['mail'] = $ulogin_data['email'];
      }
    }
  }
}