You are here

function fboauth_profile_fields in Facebook OAuth (FBOAuth) 7

Same name and namespace in other branches
  1. 6 includes/fboauth.profile.inc \fboauth_profile_fields()
  2. 7.2 includes/fboauth.profile.inc \fboauth_profile_fields()

Return a list of all profile fields supported by Profile module.

Profile module doesn't provide a "pretty" way to do this unfortunately, so altogether this is a pretty ugly looking function.

2 calls to fboauth_profile_fields()
fboauth_profile_create_user in includes/fboauth.profile.inc
Add profile info to a Drupal user array (before account creation).
fboauth_profile_form_alter in includes/fboauth.profile.inc
Add options for Profile module to the Facebook OAuth settings form.

File

includes/fboauth.profile.inc, line 14
Functions to assist with handling with Profile module data.

Code

function fboauth_profile_fields() {
  static $profile_fields;
  if (!isset($profile_fields)) {
    $profile_fields = array();
    $profile_categories = db_select('profile_field')
      ->distinct()
      ->fields('profile_field', array(
      'category',
    ))
      ->orderBy('category')
      ->execute()
      ->fetchCol();
    foreach ($profile_categories as $profile_category) {
      $result = _profile_get_fields($profile_category);
      foreach ($result as $field) {
        $profile_fields[$field->name] = (array) $field;
      }
    }
  }
  return $profile_fields;
}