Note that there are some explanatory texts on larger screens.

plurals
  1. POFacebook Graph API Posting a Comment as User
    primarykey
    data
    text
    <p>I am trying to build a comments method within a website without the Facebook comments plugin.</p> <p>It's a photogallery portion of a website and all the photos are actually hosted on the business Page, I'm doing this to make use of FBs uploading, resizing/rotate etc rather than having to build that myself too.</p> <p>As a happy bi-product to this I figured I could link comments on the website with comments on FB and have a syncrhonised comments system whereby comments posted on either site (my website or FB) will show equally on either site.</p> <p>So, I have worked out how to post the comments, but it is always posting as the Business Page, not the logged in user.</p> <p>This code posts the comment, the variable <code>obj</code> is the ID of the photo on Facebook. <code>msg</code> is obviously the comment text. I have setup methods to get the correct permissions where required which are called if the response from the post states that this is needed.</p> <pre><code>FB.api('/' + obj + '/comments', 'post', { "message": msg, "access_token": accessToken, "from": uid }, // do the post function (response) { // check the response if (!response || response.error) { // if there's an error // DO STUFF WITH ERRORS/REQUEST PERMS ETC } else { alert("Msg posted id: " + response.id); }; }); </code></pre> <p>Everything above works, but when the comment appears, it is always showing <code>from: my Page ID</code> not, what I need which would be <code>from: my user id</code></p> <p><code>accessToken</code> and <code>UID</code> is being retrieved as follows:</p> <pre><code>FB.getLoginStatus(function (response) { if (response.status === 'connected') { uid = response.authResponse.userID; accessToken = response.authResponse.accessToken; } }); </code></pre> <p>The para <code>from</code> in the first function there posts the User ID, NOT the page ID, but whether that para is there or not, it always posts the comment as the Page.</p> <p>It's frustrating the hell out of me as so far this has been pretty simple to achieve!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload