最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - Tag someone on a feed dialog with Facebook API - Stack Overflow

programmeradmin4浏览0评论

I'm using this code to share a picture on facebook.

<html xmlns=""
  xmlns:fb="">
  <head>
    <title>My Feed Dialog Page</title>
  </head>
  <body>
    <div id='fb-root'></div>
    <script src='.js'></script>
    <p><a onclick='postToFeed(); return false;'>Post to Feed</a></p>
    <p id='msg'></p>

    <script> 
      FB.init({appId: "13899290", status: true, cookie: true});

      function postToFeed() {

        // calling the API ...
        var obj = {
          method: 'feed',
          redirect_uri: 'YOUR URL HERE',
          link: '/',
          picture: '.jpg',
          name: 'Facebook Dialogs',
          caption: 'Reference Documentation',
          description: 'Using Dialogs to interact with users.'
        };

        function callback(response) {
          document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
        }

        FB.ui(obj, callback);
      }

    </script>
  </body>
</html>

i would like to tag someone who is on the picture. How can i achieve this ?

Thanks in advance

I'm using this code to share a picture on facebook.

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:fb="https://www.facebook.com/2008/fbml">
  <head>
    <title>My Feed Dialog Page</title>
  </head>
  <body>
    <div id='fb-root'></div>
    <script src='http://connect.facebook.net/en_US/all.js'></script>
    <p><a onclick='postToFeed(); return false;'>Post to Feed</a></p>
    <p id='msg'></p>

    <script> 
      FB.init({appId: "13899290", status: true, cookie: true});

      function postToFeed() {

        // calling the API ...
        var obj = {
          method: 'feed',
          redirect_uri: 'YOUR URL HERE',
          link: 'https://developers.facebook.com/docs/reference/dialogs/',
          picture: 'http://fbrell.com/f8.jpg',
          name: 'Facebook Dialogs',
          caption: 'Reference Documentation',
          description: 'Using Dialogs to interact with users.'
        };

        function callback(response) {
          document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
        }

        FB.ui(obj, callback);
      }

    </script>
  </body>
</html>

i would like to tag someone who is on the picture. How can i achieve this ?

Thanks in advance

Share Improve this question edited Dec 20, 2012 at 16:39 asked Dec 12, 2012 at 14:33 user1173169user1173169 1
  • Are you guys sure it is not possible. I'm sure i have seen this somewhere recently – user1173169 Commented Dec 20, 2012 at 16:22
Add a comment  | 

5 Answers 5

Reset to default 8 +50

Sorry, you cant tag people on feed dialog, but only the pictures using the tags param in "/photos".

The Tagging concept is available only for the Open Graph stories.

UPDATE:

You can tag a person only with a valid place parameter(if you want to hide the place in post, give any valid page id instead), the post will look something like-


I guess, this is the only possible solution for tagging the friends in a post if you are not using the open graph

FB.ui method 'feed' is the equivalent to POSTing to the /USER_ID/feed Graph API endpoint, which creates posts. And there is currently no way to create tags for posts using the api.

Ref:

https://developers.facebook.com/bugs/247911678652789

https://developers.facebook.com/docs/reference/api/post/

Alternatively, you could upload a photo to an album (or to /me/photos) and include tags for the photo:

https://developers.facebook.com/docs/reference/api/photo/ [see 'tags: create' section]

This is how I take a user uploaded file and publish it with tags:

// Upon successful file (photo) upload.
$FILEPATH = $_FILES['file']['tmp_name'];

// upload it to FB.
$args = array(
  'name' => 'Testing photo upload via php-SDK!',
  'source' => '@'.realpath($FILEPATH),
  'tags' => array(
    array('tag_uid' => USER_ID, 'x' => 20, 'y' => 40),
  )
);
$post_id = $facebook->api('/me/photos', 'post', $args);

For the feed tagging, see my previous answers here Facebook Graph API Post with_tags option

To summarise you basically need to use mention tagging

https://developers.facebook.com/docs/technical-guides/opengraph/mention-tagging/

Found this one here:

For example the following message would mention the Facebook Developers page inline:

Test message @[19292868552] tag

But your app must be reviewed first.

You can't tag images in a Post to the NewsFeed (/home) or a user's Wall (/feed). See the Graph API docs for Posts to feed. There is no tag-related parameter.

I'm sure i have seen this somewhere recently

What you have seen may be photo uploads, which do appear in the feed, but are not classified as posts to the newsfeed by the API. Photo uploads accept tag attributes. See Graph APi docs for Photo.

发布评论

评论列表(0)

  1. 暂无评论