You are here

function bakery_profile_user_presave in Bakery Single Sign-On System 7.4

Implements hook_user_presave().

File

./bakery_profile.module, line 227

Code

function bakery_profile_user_presave(&$edit, $account, $category) {
  if (variable_get('bakery_is_master', 0)) {

    // Invoke implementations of hook_bakery_transmit() for syncing arbitrary
    // data.
    $_SESSION['bakery']['data'] = module_invoke_all('bakery_transmit', $edit, $account, $category);

    // We store email/name if they changed. We want to wait with doing
    // anything else until the changes are saved locally.
    foreach (variable_get('bakery_supported_fields', array(
      'mail' => 'mail',
      'name' => 'name',
    )) as $type => $enabled) {
      if ($enabled && isset($edit[$type]) && isset($account->{$type}) && $account->{$type} != $edit[$type]) {
        $_SESSION['bakery'][$type] = $edit[$type];
      }
    }
  }
}