1

これで友達の壁に何かを公開できることを私は知っています:

$publishStream = $facebook->api("/$user/feed", 'post', array(
     'message' => "Your Message", 
     'link'    => 'http://example.com',
     'picture' => '',
     'name'    => 'App Name',
     'description'=> 'App description'
));

$user変数を友達のユーザーIDに置き換えるだけです。

私が望むのは、チェックボックスを使用して書き込みたいユーザープロファイルを友達の中から選択することです。

たとえば、ファンページを共有したい場合、これはすでに可能です。リクエストの送信先を選択します。

よろしくお願いします

4

1 に答える 1

1

Facebook のMulti-Friend-Selector (MFS)を使用できます。 https://developers.facebook.com/docs/guides/games/custom-muti-friend-selector/

Multi-Friend-Selector のドキュメントから抜粋した編集済みの例

function renderMFS() {
 // First get the list of friends for this user with the Graph API
 FB.api('/me/friends', function(response) {
   var container = document.getElementById('mfs');
   var mfsForm = document.createElement('form');
   mfsForm.id = 'mfsForm';

   // Iterate through the array of friends object and create a checkbox for each one.
   for(var i = 0; i < Math.min(response.data.length, 10); i++) {
     var friendItem = document.createElement('div');
     friendItem.id = 'friend_' + response.data[i].id;
     friendItem.innerHTML = '<input type="checkbox" name="friends" value="'
       + response.data[i].id
       + '" />' + response.data[i].name;
       mfsForm.appendChild(friendItem);
     }
     container.appendChild(mfsForm);

     // Extract selected friends' Facebook ID from value property of checked checkboxes

     // Do a for loop to send notification (refer to the link posted below) and publish post to each user's wall
   });
 }

メッセージが壁に書き込まれる前に通知を送信することは可能ですか?

はい、FacebookのIDがあれば可能です。Facebook IDを使用して友達にFacebookメッセージを送信する方法の私の回答を参照してください。

于 2012-09-12T03:59:19.123 に答える