The following code doesn't return either 1 or 0 as supposed to be, it returns nothing. I checked for params to be initialised. Both $_fb and $fbu has been initialised via watchdog output:

watchdog('kk2012','perm token:'.fb_get_token($_fb).' , $fbu: '.$fbu);

$fbu = $_fb->getUser();
$has_perm = fb_call_method($_fb, 'users.hasAppPermission', array(
					'ext_perm' => 'publish_stream',
					'uid' => $fbu,
    ));

I checked over here to see if calling this method returns anything. It does return 1 if I use uid of a user with extended permission.

Comments

skolesnyk’s picture

'Over here' I meant this link https://developers.facebook.com/docs/reference/rest/users.hasAppPermission/ .

Update: had to do everything through requesting FB methods directly like:

$url = url("https://api.facebook.com/method/stream.publish", array('query' => $params,));
$http = drupal_http_request($url);

I checked code in fb.module for fb_call_method function -- it's practically the same, so it's strange why it didn't work for me by calling this function.

Dave Cohen’s picture

Try including 'access_token' => fb_get_token($_fb, $fbu) in your params array. that will force it to use the user's token as opposed to the application's token.

skolesnyk’s picture

Thanks, Dave, will do that in next projects.)