You are here

function _sf_user_export_profile_date in Salesforce Suite 6.2

Custom export handler for user profile date field

Parameters

object $user: The user object.

string $fieldname: The name of the field being exported.

array $drupal_field_definition:

array $sf_field_definition:

Return value

An Atom-formatted date for Salesforce export, or NULL if no valid date.

1 string reference to '_sf_user_export_profile_date'
sf_user_fieldmap_objects in sf_user/sf_user.module
Implementation of hook_fieldmap_objects().

File

sf_user/sf_user.module, line 769
Integrates the core user object and profile module with the Salesforce API.

Code

function _sf_user_export_profile_date($user, $fieldname, $drupal_field_definition, $sf_field_definition) {
  $date = $user->{$fieldname};

  // checks to see if the date is in valid format for profile.module
  if (isset($date) && _sf_user_profile_date_valid($date)) {
    $timestamp = mktime(0, 0, 0, $date['month'], $date['day'], $date['year']);
    return gmdate(DATE_ATOM, $timestamp);
  }
  else {
    return NULL;
  }
}