You are here

function party_user_email_sync in Party 7

Synchronise the user email into all relevant fields.

Parameters

$account: The account we want to synchronize.

2 calls to party_user_email_sync()
party_user_user_insert in modules/party_user/party_user.module
Implements hook_user_insert().
party_user_user_update in modules/party_user/party_user.module
Implements hook_user_update().

File

modules/party_user/party_user.module, line 391
Support for linking users to parties

Code

function party_user_email_sync($account) {

  // Get our array of fields to update
  $fields = variable_get('party_user_email_sync_fields', array());

  // Check that we have some fields to work with to avoid unnecessary loads
  if (count($fields) > 0 && ($party = party_user_get_party($account))) {

    // Iterate over our fields
    foreach ($fields as $info) {
      list($data_set_name, $field_name, $column) = explode(':', $info);
      party_set_data_set_value($party, $account->mail, $data_set_name, $column, $field_name);
    }

    // Save to update primary fields.
    $controller = entity_get_controller('party');
    $controller
      ->setPrimaryFields($party);
  }
}