From 07aeb5e92101c1ff2dc2d945296bd9e16efe10a0 Mon Sep 17 00:00:00 2001 From: Dilip Raj Baral Date: Tue, 2 May 2017 23:10:09 +0530 Subject: [PATCH] Add an option to re-request permissions If a user has denied one or more permissions once, the URL given by `getLoginUrl() `won't show up the Login Dialog. The login URL needs to be generated using `getReRequestUrl()`. --- application/libraries/Facebook.php | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/application/libraries/Facebook.php b/application/libraries/Facebook.php index 047557c..9c9c390 100755 --- a/application/libraries/Facebook.php +++ b/application/libraries/Facebook.php @@ -253,9 +253,12 @@ public function send_batch_pool() /** * Generate Facebook login url for Facebook Redirect Login (web) * + * @param string $reRequest + * If the permissions should be re-asked (if they were denied before) + * * @return string */ - public function login_url() + public function login_url($reRequest = false) { // Login type must be web, else return empty string if ($this->config->item('facebook_login_type') != 'web') @@ -263,10 +266,20 @@ public function login_url() return ''; } - return $this->helper->getLoginUrl( - base_url() . $this->config->item('facebook_login_redirect_url'), - $this->config->item('facebook_permissions') - ); + if ($reRequest) + { + return $this->helper->getReRequestUrl( + base_url() . $this->config->item('facebook_login_redirect_url'), + $this->config->item('facebook_permissions') + ); + } + else + { + return $this->helper->getLoginUrl( + base_url() . $this->config->item('facebook_login_redirect_url'), + $this->config->item('facebook_permissions') + ); + } } /**