static function Refresh_fb_token($user_ID) { // https://developers.facebook.com/docs/offline-access-deprecation/ $token = WPAL2Int::Get_access_token($user_ID); if ($token) { $url = 'https://graph.facebook.com/v2.2/oauth/access_token'; $url = apply_filters('al2fb_url', $url); $query = http_build_query(array('client_id' => get_user_meta($user_ID, c_al2fb_meta_client_id, true), 'client_secret' => get_user_meta($user_ID, c_al2fb_meta_app_secret, true), 'grant_type' => 'fb_exchange_token', 'fb_exchange_token' => $token), '', '&'); $response = WPAL2Int::Request($url, $query, 'GET'); $access_token = WPAL2Int::Process_fb_token($response); update_user_meta($user_ID, c_al2fb_meta_access_token, $access_token); update_user_meta($user_ID, c_al2fb_meta_token_time, date('c')); return $access_token; } return false; }