You are here

function hook_janrain_capture_janrain_capture_profile_sync in Janrain Registration 7.4

Same name and namespace in other branches
  1. 7 janrain_capture.api.php \hook_janrain_capture_janrain_capture_profile_sync()
  2. 7.2 janrain_capture.api.php \hook_janrain_capture_janrain_capture_profile_sync()
  3. 7.3 janrain_capture.api.php \hook_janrain_capture_janrain_capture_profile_sync()

Add Capture attributes to sync to local user fields

This hook allows modules to alter the user account object based on Janrain Capture profile data. It is invoked whenever a user logs in or updates their profile in Janrain Capture.

The hook can be used in conjunction with Entity API module to set the values of Field API fields on the user object, or without Entity API to alter any properties (including fields, but the full array stucture of the field would need to be provided) on the object.

Parameters

$account: The user account to sync

array $capture_profile: The profile data returned from the user's Capture record

File

./janrain_capture.api.php, line 78
Hooks provided by Janrain Capture

Code

function hook_janrain_capture_janrain_capture_profile_sync($account, $capture_profile) {

  // This example uses Entity API module to alter the 'field_gender' value based
  // on what's received from Janrain Capture. The $account parameter is an object
  // and so it is passed by reference.
  if (isset($capture_profile['gender'])) {
    $account_wrapper = entity_metadata_wrapper('user', $account);
    $account_wrapper->field_gender = $capture_profile['gender'];
  }
}