You are here

function fb_preprocess_username in Drupal for Facebook 7.4

Implements hook_preprocess_username().

Add attributes allowing fb.js to learn the username from facebook. Replaces machine names like 12345@facebook with real names.

File

./fb.module, line 525

Code

function fb_preprocess_username(&$variables) {
  if ($pos = strpos($variables['name'], '@facebook')) {
    $fbu = substr($variables['name'], 0, $pos);
    if ($fbu) {

      // Attributes that fb.js can use to display human-readable names.
      $variables['link_options']['#attributes']['data-fbu'] = $fbu;
      $variables['attributes_array']['data-fbu'] = $fbu;
    }
  }
}