/** * Retrieves the list of all authorised permissions for the current user * with the most updated version from the server * @return array List of approved permissions, or empty array if none are approved */ public function updateGrantedFacebookPermissions() { // Check user is logged in $user = FacebookAPI::get()->getUser(); if (empty($user)) { return array(); } // Check permissions are retrieveable $permissions = FacebookAPI::get()->api("/{$user}/permissions"); if (empty($permissions['data'])) { return array(); } // $permissions should look something like the below // $permissions = array('data' => array(array('installed' => 1, 'email' => 1)), 'paging' => array()) // Merge each array element in data $permissionItems = call_user_func_array('array_merge', $permissions['data']); return array_keys($permissionItems); }