You are here

public function SimpleFbConnectFbManager::getEmail in Simple FB Connect 8.3

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

Returns user's email address from Facebook profile.

Parameters

\Facebook\GraphNodes\GraphNode $fb_profile: GraphNode object representing user's Facebook profile.

Return value

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

File

src/SimpleFbConnectFbManager.php, line 290

Class

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

Namespace

Drupal\simple_fb_connect

Code

public function getEmail(GraphNode $fb_profile) {
  if ($email = $fb_profile
    ->getField('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;
}