You are here

public function SimpleFbConnectFbManager::getEmail in Simple FB Connect 8.2

Same name and namespace in other branches
  1. 8.3 src/SimpleFbConnectFbManager.php \Drupal\simple_fb_connect\SimpleFbConnectFbManager::getEmail()

Returns user's email address from Facebook profile.

Parameters

\Facebook\GraphObject $fb_profile: User's Facebook profile.

Return value

string|false User's email address if found False otherwise

File

src/SimpleFbConnectFbManager.php, line 286
Contains \Drupal\simple_fb_connect\SimpleFbConnectFbManager.

Class

SimpleFbConnectFbManager
Contains all Simple FB Connect logic that is related to Facebook interaction.

Namespace

Drupal\simple_fb_connect

Code

public function getEmail(GraphObject $fb_profile) {
  if ($email = $fb_profile
    ->getProperty('email')) {
    return $email;
  }

  // Email address was not found. Log error and return FALSE.
  $this->loggerFactory
    ->get('simple_fb_connect')
    ->error('No email address in Facebook user profile');
  return FALSE;
}