Facebook js sdk:“选择一个朋友”对话,然后张贴到他们的墙上? [英] Facebook js sdk: "select a friend" dialog, then post to their wall?

查看:142
本文介绍了Facebook js sdk:“选择一个朋友”对话,然后张贴到他们的墙上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



现在在我的iframe标签中使用新的javascript sdk。







  1. 选择好友








1:未解决




通过新的api,我找不到一种选择一个朋友对话框的方式。 FB.ui中唯一提到的是一个用于邀请朋友的朋友对话。



也许我需要一个对话框(哪一个)来选择一个朋友而不是post?理想的是多人选择器,所以我可以发布给用户可以选择的朋友的数量。




2:已解决




(欢迎任何其他解决方案)



要发布在朋友墙上,我可以简单填写feed对话框的到参数如下所述: http://开发人员.facebook.com / docs / reference / dialogs / feed /







我发现一些不太优雅的解决方案:




请求访问以管理用户的朋友,然后:




  1. 自己单选弹出


    看起来像重做轮子,一些FBML页面通过一个简单的feed对话框解决了这个问题,你可以在这里看到: http://www.facebook.com/chanel



  2. 使用一个jQuery插件解析朋友列表,并为我做对话


    看起来像一个过度的/不能很好的








我觉得我错过了一些东西(这是我第二次使用新的js sdk),这么简单的任务应该很直向前解决

解决方案

我也有同样的问题。虽然回答问题已经很晚了,但会帮助别人。这就是为什么回答这个问题。



要发送邀请函时调用此Javascript函数。

 code> function sendRequestViaMultiFriendSelector(){
FB.ui({
method:'apprequests',
message:此消息显示在邀请
},send_wall_invitation );

}

函数send_wall_invitation(response){
// alert(response.to);
var send_invitation_url = base_url +'send_invitation';
jQuery.ajax({
url:send_invitation_url,
data:{
to:response.to
},
dataType:json,
type:'POST',
success:function(data){
// alert();
}

})
}

发送由ajax邀请的朋友数组,然后发送每个朋友的帖子。
我可以通过PHP API发布在用户的朋友墙上。
尝试这样:

  $ facebook-> api('/ [FRIEND_ID] / feed','post' ,数组(
'message'=>'test message',
'link'=>'http://google.com',
'name'=>'test名称',
'caption'=>'test caption',
'description'=>'test long description',
));


Needs to resolve that procedure.

Now using the new javascript sdk, inside my "iframe tab".


  1. Select friend(s)

  2. Post in their wall.


1: not solved

I couldn't find a way of poping a "select a friend" dialog, trough the new api. The only mention in FB.ui is about a "friends dialog" used to "invite a friend".

Maybe I need a dialog ( which one ) to select a friend and than post? Ideally multi-friend selector so I can post to as many friends as a user can choose?

2: solved

( any other solution is welcome )

To post in a friends wall, I can simply fill the "to" param of the "feed dialog" as explained here: http://developers.facebook.com/docs/reference/dialogs/feed/


Some not so elegant solutions I found:

ask access to manage user friends then:

  1. Do the multi selection pop up by myself

    looks like redoing the wheel, some FBML pages solved that problem with a simple feed dialog with friend selector, as you can see here: http://www.facebook.com/chanel

  2. Use a jquery plugin that parses the friends list and do the dialog for me

    looks like a overkill / not working very well


I feel like I'm missing something ( this is my second work with the new js sdk ), such a easy task should be pretty straight forward to solve.

解决方案

I had same problem. Though it is very late for answering question, it will help somebody. That's why answering this question.

Call this Javascript function when want to send invitations.

function sendRequestViaMultiFriendSelector() {
    FB.ui({
        method: 'apprequests',
        message: "This message is displayed in invitation"
    },send_wall_invitation);

}

function send_wall_invitation(response) {
   // alert(response.to);
    var send_invitation_url=base_url+'send_invitation';
    jQuery.ajax({
        url:send_invitation_url,
        data:{
            to:response.to
            },
        dataType:"json",
        type: 'POST',
        success: function(data){
//            alert("");
        }

    })
}

Sending array of friends invited by ajax and then send post for each friend. I can post on the user's friends walls via the PHP API. Try this :

$facebook->api('/[FRIEND_ID]/feed', 'post', array(
          'message' => 'test message',
          'link' => 'http://google.com',
          'name' => 'test name',
          'caption' => 'test caption',
          'description' => 'test long description',
      ));

这篇关于Facebook js sdk:“选择一个朋友”对话,然后张贴到他们的墙上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆