Yesterday I changed the application settings and enabled "New Data Permissions" and "New SDKs".
After that the feature of posting message to the users wall stopped working. On my website, users login using facebook API (Graph) and are able to post messages on their wall.
This is my old code that was working fine:
function publish_with_permission(permission,action_links,attachment) { FB.ensureInit(function() { FB.Connect.requireSession(function(){ //check is user already granted for this permission or not FB.Facebook.apiClient.users_hasAppPermission(permission, function(result) { // prompt offline permission if (result == 0) { // show the facebook permission dialog FB.Connect.showPermissionDialog(permission, function(result){ if (!result) { FB.Connect.streamPublish('', attachment, action_links, null, "Post this:", jscallback); } else { // permission granted, post without facebook dialog FB.Connect.forceSessionRefresh(function() { FB.Connect.streamPublish('', attachment, action_links, null, "Post this:", jscallback,true); }); } }, true, null); } else { // permission already granted, post suddenly // without facebook dialog FB.Connect.streamPublish('', attachment, action_links, null, "Post this:", jscallback,true); } }); }); }); }
The function just hangs and nothing happens. I searched on this forum and found this post
function fb_publish() { FB.ui( { method: 'stream.publish', message: 'Message here.', attachment: { name: 'Nom ici.', caption: 'Caption here.', description: ( 'description here' ), href: 'url here' }, action_links: [ { text: 'Code', href: 'action url here' } ], user_prompt_message: 'Personal message here' }, function(response) { if (response && response.post_id) { alert('Post was published.'); } else { alert('Post was not published.'); } } ); }
This one works, but it has two problems 1) Even though when the user logs in first time using graph API and they have granted extended permissions to publish to their wall, this method will everytime ask the user whether to allow or not - The previous one did not do that. 2) This method also allows user to add their comments - I dont want this either.
I want to seamlessly publish to the wall without again explicitly asking for the permission as they have already granted it before.
I am using PHP - any tips will be appreciated Thanks