Rajinder Deol
Rajinder Deol

Reputation: 111

How to make a pop up to ask user for extended permission in an i-frame application

I am trying to build a facebook app using iframe (not fbml). I am using php client. after trying a lot I'm not able to publish stream also I am not able to create a pop up to ask user for extended permission. I have used the following:

function facebook_prompt_permission(permission) 
{
    ensure_init(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) 
               {
                  alert(result);
                  // render the permission dialog
                  FB.Connect.showPermissionDialog(permission,function(result)
                  {
                        if (result == null)
                            alert('no permissons granted');
                        else
                            alert('permissions ' + result);
                  },true,null);
               } 
               else 
               {
                   // permission already granted.
                   alert("permission already granted");
               }
       });
   });
}




facebook_prompt_permission('publish_stream');

The response for checking the permission comes as 0 but when I try FB.Connect.showPermissionDialog to show pop up to ask user for permission nothing happens; no pop up.

Upvotes: 1

Views: 2187

Answers (1)

Justin
Justin

Reputation: 11

/* Need to check this user has the permissions to post to wall etc....*/
if (!$facebook->api_client->users_hasAppPermission("publish_stream")) {
    // Redirect for permissions
    $url = "http://www.facebook.com/connect/prompt_permissions.php?api_key=$apikey&v=1.0&ext_perm=publish_stream&next=[YOURAPPURL]";
    header("Location: $url");
    exit;
}

Upvotes: 1

Related Questions