Topic-icon Channels - manage_pages permission

Support Specialist
9 years 11 months ago #44146 by alzander
Thanks for your patience. We've narrowed down the issue and have the minor code change required to make it work. To implement it, please open the /components/com_jfbconnect/libraries/provider/facebook.php file. Around line 295, you'll see the following block of code:
public function getUserScope($uid)
    {   
        // get current scope for the user
        $return = array();
        $params['access_token'] = JFBCFactory::usermap()->getUserAccessToken($uid, 'facebook');
        $currentScope = $this->api('/' . $uid . '/permissions', $params, true, 'GET');
        if (isset($currentScope['data']) && isset($currentScope['data'][0]))
        {   
            $currentScope = $currentScope['data'][0];
            foreach ($currentScope as $scope => $val)
            {   
                if ($val == 1)
                    $return[] = $scope;
            }   
        }   
        return $return;
    }
Replace that whole function with the below, which will properly detect the user's granted permissions using the older Facebook methods or the newer ones implemented in new Applications after May 1st:
public function getUserScope($uid)
    {
        // get current scope for the user
        $return = array();
        $params['access_token'] = JFBCFactory::usermap()->getUserAccessToken($uid, 'facebook');
        $currentScope = $this->api('/' . $uid . '/permissions', $params, true, 'GET');
        if (isset($currentScope['data']) && isset($currentScope['data'][0]))
        {
            foreach ($currentScope['data'] as $scope)
            {
                // Check for v2.0 of Graph API
                if (array_key_exists('permission', $scope))
                {
                    if ($scope['status'] == 'granted')
                        $return[] = $scope['permission'];
                }
                else
                {
                    foreach ($scope as $permission => $val)
                    {
                        if ($val == 1)
                            $return[] = $permission;
                    }
                }
            }
        }
        return $return;
    }
That change will definitely be in the next release of JFBConnect, so you won't have to make this change again in the future.

Please let us know if that fixes you up. If you need more assistance or have any feedback, we'd love to hear it.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
9 years 11 months ago #44165 by cyberbanan
Yes, it works!
Thank you!
The topic has been locked.
Support Specialist
9 years 11 months ago #44175 by alzander
Awesome! I'm very glad to hear that helped get you going. If you need any more help with this issue, just let us know.

Thanks,
Alex
The topic has been locked.