I need help to setup facebook application

I have some problem to setup application on facebook, ok what is exactly problems?

Im load script

<script src="http://connect.facebook.net/en_US/all.js"></script>

And this

$(document).ready(function () {
   // Pocetak callbacks funkicja
  $("#oceni_fbPrijatelje").click(function() {
   $("#sidecenter ,#sidedesno,#sidelevo").addClass("fb_over");
  FB.init({
        appId  : 'xxxxxxxxx959971',
      });

    // 1. User se loguje i uzimamo neke informacija sa FB-a
    FB.login(function(response) {
      if(response.authResponse) {
        accessToken = response.authResponse.accessToken;
        signedRequest = response.authResponse.signedRequest;

         // 2. Uzimamo informacija za logovane usere
        FB.api('/me', function(response) {
          facebook_id = response.id;
          $.cookie("facebook_id", facebook_id);

          // 3. Konacno iskace jebeni popup
          FB.ui({
            method: 'apprequests',
            message: response.name + ' želi da vidi tvoje fotke na xxxxx.',
            max_recipients: 10,
            exclude_ids: [], // ovo nisam siguran dal radi :( ako radi dobro je.
            title: 'Izaberi prijatelje i pozovi na xxxxx' , 
            }, requestCallback);
     }     );
       function requestCallback(response) {

        // Handle callback here
      $("#sidecenter ,#sidedesno,#sidelevo").removeClass("fb_over");
    }     
}
        });
    });
});

And popup is loaded fine on my site

这里是屏幕

So users can send invite to friends from my site on facebook.. but when users receive request on facebook simple this notification always is appers on their profil, you can click accept and facebook redirect to app url but request is still there simple cant accept this..

在这里输入图像描述

In the app option on facebook im setup Canvas URL: http://mysite.com

So application will load my home page , but all works very strange and dont know why Application request always is stay on users profil...


You need to delete those requests. According to Facebook:

It is the Developers' responsibility to delete a Request once it has been accepted. For more information on how to delete a Request, please see the Deleting Requests documentation.

When someone accept an invite he goes to app and the request id is added to the url. You can catch it from there and send a delete request.

$request_ids = explode(',', $_REQUEST['request_ids']);

function build_full_request_id($request_id, $user_id) {
      return $request_id . '_' . $user_id; 
}

foreach ($request_ids as $request_id) {
      $full_request_id = build_full_request_id($request_id, $user_id);  
      $delete_success = $facebook->api("/$full_request_id",'DELETE');
}

You can find the full code and more information on deleting requests here:

http://developers.facebook.com/docs/requests/#deleting

链接地址: http://www.djcxy.com/p/53354.html

上一篇: winform facebook应用程序接受好友请求

下一篇: 我需要帮助来设置Facebook应用程序