Skip to content

Instantly share code, notes, and snippets.

@lkacenja
Created January 29, 2019 15:43
Show Gist options
  • Save lkacenja/032b8efffe26e9485cbbf33fc5ba04d3 to your computer and use it in GitHub Desktop.
Save lkacenja/032b8efffe26e9485cbbf33fc5ba04d3 to your computer and use it in GitHub Desktop.
Look up a user by email and print out their social log in provider name.
<?php
$email = '<email>';
$query = \Drupal::service('database')->select('users_field_data', 'users');
$query->join('oneall_social_login_authmap', 'map', 'users.uid=map.uid');
$query->join('oneall_social_login_identities', 'identity', 'identity.aid=map.aid');
$query->addField('identity', 'provider_name', 'provider_name');
$query->condition('users.mail', $email);
$result = $query->execute()->fetchAll();
array_walk($result, 'print_r');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment