function fb_user_app_get_proxied_email in Drupal for Facebook 7.3
Same name and namespace in other branches
- 6.3 contrib/fb_user_app.module \fb_user_app_get_proxied_email()
Learn the user's proxied email address.
1 call to fb_user_app_get_proxied_email()
- fb_user_get_proxied_email in ./
fb_user.module - Learn the user's proxied email address. If fb_user_app.module is enabled, it will defer to that module, which queries a local database. If not, ask facebook for the data.
1 string reference to 'fb_user_app_get_proxied_email'
- fb_user_get_proxied_email in ./
fb_user.module - Learn the user's proxied email address. If fb_user_app.module is enabled, it will defer to that module, which queries a local database. If not, ask facebook for the data.
File
- contrib/
fb_user_app.module, line 220 - This module manages relations between local Drupal user accounts and their accounts on facebook.com by application.
Code
function fb_user_app_get_proxied_email($fbu, $fb_app) {
// Try to learn from local database
$result = db_query("SELECT * FROM {fb_user_app} WHERE apikey=:apikey AND fbu=:fbu", array(
':apikey' => $fb_app->apikey,
':fbu' => $fbu,
));
if ($data = $result
->fetchObject()) {
$mail = $data->proxied_email;
}
if (!isset($mail) || !$mail) {
// Ask facebook for info.
$fb = fb_api_init($fb_app);
$info = fb_users_getInfo(array(
$fbu,
), $fb);
$data = $info[0];
$mail = $data['proxied_email'];
if ($mail && variable_get(FB_USER_APP_VAR_TRACK_USERS, TRUE)) {
// Store locally.
$result = db_query("UPDATE {fb_user_app} SET proxied_email=:mail WHERE apikey=:apikey AND fbu=:fbu", array(
':mail' => $mail,
':apikey' => $fb_app->apikey,
':fbu' => $fbu,
));
}
}
return $mail;
}