CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   JavaScript programming (http://www.codingforums.com/forumdisplay.php?f=2)
-   -   facebook postToFeed() on phpbb3 post, slight issue, help required (http://www.codingforums.com/showthread.php?t=285452)

tonyjms2005 01-08-2013 12:28 PM

facebook postToFeed() on phpbb3 post, slight issue, help required
 
I have a phpbb3 forum that I have modified for my requirements. I have used the Facebook post to feed dialog to allow users to send the text from their forum post to their facebook wall.

I have added the code between the <!-- BEGIN postrow --> <!-- END postrow --> tags.

The postToFeed() function works well, all except when I there are more then one post to a topic/thread. The PostToFeed() button/link appears on each post of the topic, but when using the function, it will only post the most recent post in the topic rather than the post that the button/link appears on.

Has anyone please got any suggestions? Here is my code from the viewtopic_body.html or which I have removed some of the styling to make the code easier to read:




Code:

    <!-- BEGIN postrow -->
                        <div class="postbody">
       
       
                                <a href="#p{postrow.POST_ID}">{postrow.POST_SUBJECT}</a>
                               
                                <div class="content">{postrow.MESSAGE}</div> ************************this is the topic text content here               
                        </div>
       
                       
                <div id='fb-root'></div>
       
            <script src='http://connect.facebook.net/en_US/all.js'></script>
            <p><img src="http://static.ak.facebook.com/images/share/facebook_share_icon.gif?6:26981"/><a onclick='postToFeed(); return false; '>Post to Facebook profile</a></p>
            <p id='msg'></p>
            <script>
              FB.init({appId: "83103676329", status: true, cookie: true});
       
              function postToFeed() {
       
                // calling the API ...
                var obj = {
                  method: 'feed',
                  redirect_uri: 'http://tributetothem.com',
                  link: 'http://www.tributetothem.com/phpBB3/viewtopic.php?p={postrow.POST_ID}',
                  picture: 'http://tributetothem.com/images/logo.gif',
                  name: '{TOPIC_TITLE}',
                  caption: 'http://tributetothem.com',
                  description: '{postrow.MESSAGE}'  ************************this is the topic text content here
                };
       
                function callback(response) {
                  document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
                }
       
                FB.ui(obj, callback);
              }
           
            </script>
       
                </div>
        <!-- END postrow -->


Thanks in advance

Antony

tonyjms2005 01-08-2013 02:13 PM

Hi

I just solved it using the post_id as a variable for the function name.

Thanks

Antony


All times are GMT +1. The time now is 02:37 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.