Example #1
0
 /**
  * Is the user currently logged in with FB Connect?
  *
  * @return mixed $fbuid the Facebook ID of the logged in user, or null
  */
 function loggedIn()
 {
     $user = common_current_user();
     if (!empty($user)) {
         $flink = Foreign_link::getByUserId($user->id, FACEBOOK_CONNECT_SERVICE);
         $fbuid = 0;
         if (!empty($flink)) {
             try {
                 $facebook = getFacebook();
                 $fbuid = getFacebook()->get_loggedin_user();
             } catch (Exception $e) {
                 common_log(LOG_WARNING, 'Problem getting Facebook client: ' . $e->getMessage());
             }
             if ($fbuid > 0) {
                 return $fbuid;
             }
         }
     }
     return null;
 }