You are here

function fboauth_user_properties in Facebook OAuth (FBOAuth) 6

Same name and namespace in other branches
  1. 7.2 includes/fboauth.fboauth.inc \fboauth_user_properties()
  2. 7 includes/fboauth.fboauth.inc \fboauth_user_properties()

Return a list of Facebook user properties.

This function provides a list of properties that may be attached directly to a Facebook user account. This information is immediately available when a user logs in with Facebook connect and may be stored locally.

Each property requires extended permission granted by the end-user. The returned array of properties provides the name of each required permission and a human-readable name for the property.

Note that access to a user's id, name, first_name, last_name, gender, locale, link, username, third_party_id, timezone, updated_time, and verified properties are always available if the user grants generic access to your application.

Parameters

$include_common: Optionally include all common properties in this list.

See also

fboauth_user_connections()

http://developers.facebook.com/docs/reference/api/user/

http://developers.facebook.com/docs/authentication/permissions/

3 calls to fboauth_user_properties()
fboauth_profile_form_alter in includes/fboauth.profile.inc
Add options for Profile module to the Facebook OAuth settings form.
fboauth_settings_form in includes/fboauth.pages.inc
Menu callback; Display the settings form for Facebook OAuth.
fboauth_user_permissions in includes/fboauth.fboauth.inc
Return a list of permissions based on a list of properties or connections.
4 string references to 'fboauth_user_properties'
fboauth_settings_form in includes/fboauth.pages.inc
Menu callback; Display the settings form for Facebook OAuth.
fboauth_settings_form_submit in includes/fboauth.pages.inc
Form submission function for fboauth_settings_form().
fboauth_uninstall in ./fboauth.install
Implements hook_uninstall().
fboauth_user_connect_permissions in includes/fboauth.fboauth.inc
Utility function to retrieve all permissions required for Facebook connect.

File

includes/fboauth.fboauth.inc, line 390
Provides functions used during Facebook login processes.

Code

function fboauth_user_properties($include_common = FALSE) {
  $properties = array(
    'about' => array(
      'permission' => 'user_about_me',
      'label' => t('About me (a short bio)'),
    ),
    'bio' => array(
      'permission' => 'user_about_me',
      'label' => t('Biography'),
    ),
    'birthday' => array(
      'permission' => 'user_birthday',
      'label' => t('Birthday'),
    ),
    'education' => array(
      'permission' => 'user_education_history',
      'label' => t('Education history'),
    ),
    'email' => array(
      'permission' => 'email',
      'label' => t('E-mail'),
    ),
    'hometown' => array(
      'permission' => 'user_hometown',
      'label' => t('Hometown'),
    ),
    'location' => array(
      'permission' => 'user_location',
      'label' => t('Location'),
    ),
    'relationship_status' => array(
      'permission' => 'user_relationships',
      'label' => t('Relationship status (Single, Married, It\'s complicated, etc.)'),
    ),
    'interested_in' => array(
      'permission' => 'user_relationship_details',
      'label' => t('Interested in (Men, Women)'),
    ),
    'significant_other' => array(
      'permission' => 'user_relationship_details',
      'label' => t('Signficant other'),
    ),
    'political' => array(
      'permission' => 'user_religion_politics',
      'label' => t('Political view'),
    ),
    'quotes' => array(
      'permission' => 'user_about_me',
      'label' => t('Favorite quotes'),
    ),
    'religion' => array(
      'permission' => 'user_religion_politics',
      'label' => t('Religion'),
    ),
    'website' => array(
      'permission' => 'user_website',
      'label' => t('Website'),
    ),
    'work' => array(
      'permission' => 'user_work_history',
      'label' => t('Work history'),
    ),
  );

  // Common properties. Always defined so that modules may alter if needed.
  $common = array(
    'id' => array(
      'label' => t('Facebook ID'),
    ),
    'name' => array(
      'label' => t('Full name'),
    ),
    'first_name' => array(
      'label' => t('First name'),
    ),
    'last_name' => array(
      'label' => t('Last name'),
    ),
    'gender' => array(
      'label' => t('Gender'),
    ),
    'locale' => array(
      'label' => t('Locale'),
    ),
    'link' => array(
      'label' => t('Facebook profile link'),
    ),
    'username' => array(
      'label' => t('Username'),
    ),
    'third_party_id' => array(
      'label' => t('3rd-party ID'),
    ),
    'timezone' => array(
      'label' => t('Timezone'),
    ),
    'updated_time' => array(
      'label' => t('Updated time'),
    ),
    'verified' => array(
      'label' => t('Verified'),
    ),
  );
  $properties += $common;
  drupal_alter('fboauth_user_properties', $properties);
  ksort($properties);

  // Filter out unneeded properties.
  if (!$include_common) {
    $properties = array_diff_key($properties, $common);
  }
  return $properties;
}