× Joomla Facebook Connect support forum

Topic-icon publish_actions

Active Subscriptions:

None
14 years 7 months ago #14563 by Ivan
publish_actions was created by Ivan
Hi,

For game achievements i need to prompt users for the publish actions permissions.

in the facebook library folder i have which would prompt the users when first connecting right?

$requiredPerms = "email,publish_stream,publish_actions,user_photos";


but how do i prompt already connected users for this permission?
The topic has been locked.
Support Specialist
14 years 7 months ago #14589 by alzander
Replied by alzander on topic publish_actions
Ivan,
For already connected users, you'll need to do Javascript and call the FB.login function. This will pop-up a login dialog (if the user isn't logged in) as well as a permissions dialog. If the user is already logged in and the permission is already granted, the pop-up will automatically close. You can use a callback in this function as well. We do something similar in our login_button_click function in our jfbconnect.js file, which you can use for reference, but likely won't be able to use directly. For more information on FB.login, see:
developers.facebook.com/docs/reference/javascript/FB.login/

Hope that helps,
Alex
The topic has been locked.
Active Subscriptions:

None
14 years 7 months ago #14608 by Ivan
Replied by Ivan on topic publish_actions
okay.

i have the code that would prompt the login dialogue when u come to the site. but it would keep poping this up for everyone that comes to the site. is there anyway to check in the systemplugin if the permission has been given if not prompt the user for it?

window.fbAsyncInit = function() {
FB.init({appId: '{$appId}', status: true, cookie: true, xfbml: true, oauth: true, channelUrl: '{$channelurl}'});{$subs}{$resizeCode}

FB.Canvas.setAutoResize(); 

//WORKS
//FB.getLoginStatus(function(response){ if (response.status !== 'connected') { jfbc.login.login_custom(); }});
 
};
The topic has been locked.
Support Specialist
14 years 7 months ago #14614 by alzander
Replied by alzander on topic publish_actions
The dialog prompt has to be shown and approved by the user. That has to be done through Javascript, and it can't be done through PHP directly. Our PHP code creates the Javascript which does the request dialog. There are ways to redirect to a full Facebook page with the authentication prompt (not in a pop-up), but it takes the user away from your site and out of whatever they're doing. It's possible through PHP, but I don't think it's what you're looking for.

There are ways to 'ask' Facebook through Javascript if certain permissions are granted, and if not, to ask for them. I don't know them off hand tough. Additionally, it sounds like you're doing all your logic for assigning points through PHP, which means the permission already has to have been granted. You'll need to either move to an AJAX method which can check for permission, request it, and then do a call to your server to assign the points (or whatever you're doing), or do it through PHP with a full-page redirect for permissions with a return value of your page to assign the points and clean up what needs to be done on your site.

Hope that helps,
Alex
The topic has been locked.