You are here

function janrain_capture_profile_field in Janrain Registration 6

Function to retrive the value of a dot-delimited field name from the returned Capture user profile.

2 calls to janrain_capture_profile_field()
janrain_capture_oauth in ./janrain_capture.pages.inc
Callback for the janrain_capture/oauth menu item. This serves as the redirect_uri Capture redirects the user to and performs the authentication.
janrain_capture_profile_sync in ./janrain_capture.pages.inc
Callback for the janrain_capture/profile_sync menu item. Retrieves the most recent data from Capture and stores values locally.

File

./janrain_capture.pages.inc, line 245
User page callbacks for the janrain_capture module.

Code

function janrain_capture_profile_field($profile) {
  $janrain_capture_fields = variable_get('janrain_capture_fields', array());
  $name = !empty($janrain_capture_fields['capture_name_field']) ? $janrain_capture_fields['capture_name_field'] : 'email';
  if (strpos($name, '.')) {
    $names = explode('.', $name);
    $value = $profile['result'];
    foreach ($names as $n) {
      $value = $value[$n];
    }
    return $value;
  }
  else {
    return $profile['result'][$name];
  }
}