Facebook Request Dialog and "app_non_users" filter not working
Asked Answered
F

2

6

I have problem with apprequests and ['app_non_users'] filter. Code:

 window.fbAsyncInit = function() {
    FB.init({appId: '123', status: true, cookie: true, xfbml: true});
  }

  function sendRequestViaMultiFriendSelector() {
    FB.ui({
      method: 'apprequests',
      filters: ['app_non_users'],
      message: 'Hello there!'
    }, function callback(response) {
        if (response) {
            //do some stuff
        }
    });
  }

And as you might guess facebook displays all friends (even those already using the application). Any suggestion?

Thanks!

Frap answered 6/5, 2013 at 14:55 Comment(3)
I had same trouble once, to solve it you might want to try using more than one filter. I mean, use filters: ['app_non_users','all']Peek
Nope, still the same ;/Frap
Anybody knows what is going on?Frap
G
0

use

function(response) {  
    // callback function  
}

not

function callback(response) {  
    // callback function  
}

or otherwise like this ..

FB.ui({method: 'apprequests',
 title: app_title,
 message:inviteMsg,
 data:"invite"   ,
 filters: ['app_non_users']
}, inviteSent);

function inviteSent(response){
  log(response);     
}  
Gross answered 6/5, 2013 at 15:30 Comment(1)
Callback has no effect on the filters and 'app_non_users'. Still the same.Frap
S
0

I've found that this works for me:

function sendRequest() {
    FB.ui({
      method: 'apprequests',
      message: 'Check out this application!',
      title: 'Send your friends an application request',
      filters: ['app_non_users']
    },
    function (response) {
        console.log(response);
      if (response.request && response.to) {
        var request_ids = [];
        for(i=0; i<response.to.length; i++) {
          var temp = response.request + '_' + response.to[i];
          request_ids.push(temp);
        }
        var requests = request_ids.join(',');
        $.post('<?=base_url()?>handle_requests',{uid: '<?php echo $user; ?>', request_ids: requests},function(resp) {
          // callback after storing the requests
        });
      } else {
        alert('canceled');
      }
    });
    return false;
  }
Smitt answered 13/11, 2013 at 10:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.