function fb_user_app_get_proxied_email in Drupal for Facebook 6.3
Same name and namespace in other branches
- 7.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 211 - 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='%s' AND fbu=%d", $fb_app->apikey, $fbu);
if ($data = db_fetch_object($result)) {
$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='%s' WHERE apikey='%s' AND fbu=%d", $mail, $fb_app->apikey, $fbu);
}
}
return $mail;
}