RSS syndication - show all thread posts, not just new threads
#11
Since I was impatient, I have made my own adaptation to MyBB 1.4.6 as follows.

The following is a unified context diff of syndication.php, so the lines that were removed from the distributed version are marked with a leading - and the lines inserted instead are marked with a leading + sign.

I have chosen to revert to a select with JOIN, but at least, instead of joining 4 tables as with the previous version, I am only joining two tables.

Since the syndication of replies is only desirable in lower-traffic boards, the performance penalty should not be too bad. I think I would not need the items array altogether now, but I didn't want to deviate from the current code more than necessary.
Both subject and dateline are taken from the post instead of the thread, this will usually make replies discernable by the leading "RE:".
The link is formed leading to the individual post.

diff -u -r1.1 syndication.php
--- syndication.php     2009/05/24 21:33:27     1.1
+++ syndication.php     2009/05/25 23:08:10
@@ -111,40 +111,35 @@
 );
 $feedgenerator->set_channel($channel);

-// Get the threads to syndicate.
-$query = $db->simple_select("threads", "subject, tid, dateline, firstpost", 
-"visible='1' AND closed NOT LIKE 'moved|%' ".$forumlist, 
-array('order_by' => 'dateline', 'order_dir' => 'DESC', 'limit' => $thread_limit));
-// Loop through all the threads.
-while($thread = $db->fetch_array($query))
+// Get the posts to syndicate.
+$query = $db->query("
+       SELECT p.subject, t.tid, p.pid, p.dateline, p.edittime, p.message,
+       p.fid FROM ".TABLE_PREFIX."posts p
+       LEFT JOIN ".TABLE_PREFIX."threads t ON (p.tid=t.tid)
+       WHERE t.visible='1' AND t.closed NOT LIKE 'moved|%' ".$forumlist."
+       ORDER BY p.dateline DESC LIMIT 0,".$thread_limit);
+// Loop through all the posts.
+while($post = $db->fetch_array($query))
 {
-    $items[$thread['tid']] = array(
-        "title" => $thread['subject'],
-        "link" => $channel['link'].get_thread_link($thread['tid']),
-        "date" => $thread['dateline'],
+    $items[$post['pid']] = array(
+        "title" => $post['subject'],
+        "link" => $channel['link'].get_post_link($post['pid'],$post['tid'])."#pid".$post['pid'],
+        "date" => $post['dateline'],
     );

-    $firstposts[] = $thread['firstpost'];
-}
-
-if(!empty($firstposts))
-{
-    $firstpostlist = "pid IN(".$db->escape_string(implode(',', $firstposts)).")";
-    $query = $db->simple_select("posts", "message, edittime, tid, fid", 
- $firstpostlist, array('order_by' => 'dateline', 'order_dir' => 'desc'));
-    while($post = $db->fetch_array($query))
-    {
               $parser_options = array(
                       "allow_html" => $forumcache[$post['fid']]['allowhtml'],
                       "allow_mycode" => $forumcache[$post['fid']]
...
-        $items[$post['tid']]['description'] = $parser->parse_message($post['message'], $parser_options);
-        $items[$post['tid']]['updated'] = $post['edittime'];
-        $feedgenerator->add_item($items[$post['tid']]);
-    }
+        $items[$post['pid']]['description'] = $parser->parse_message($post['message'], $parser_options);
+        $items[$post['pid']]['updated'] = $post['edittime'];
+        $feedgenerator->add_item($items[$post['pid']]);
 }

Reply
#12
Hello guys, thank you very much for sharing this ideas and to try to get myBB even better.

I installed a wibiya bar in my website and with this bar I'm able to receive any RSS feeds from anywhere and integrate my facebook "fan page", Twitter and my myBB forum as well, and having the latest posts RSS syndication in myBB is very usefull as those posts goes automatically to those social networks mentioned and to my website simultaniuosly.

I'm intending to install the bar to the forum as well, but first I need to test it in the website first with the latest posts via RSS and see if it works.

OMG, I was looking for this and I found it! Smile

I'm gonna try the different codes published here, thank you guys.
Reply
#13
Hi Everyone..

I read all the post of this thread and I do not understand means we have to post our new thread or something.
Can anyone suggest me I am newbie here.
Thanks in advance.
Reply
#14
Follow this LINK

There, RSS is explained 100%

What this thread is about, is to try to send or receive via RSS, the posts or the latest posts from our forums to wherever we want to send (share) to, or to wherever we want to receive from.

By default, and I don't know why...MyBB sends or receives the threads or latest threads created, instead of posts itselfs as the beggining of any thread is based of a post.

Some guys here shared some tutorial posted in order to achieve this but, as myBB is updated, the file syndication.php is changing and changing. For example, I was trying to make some changes in my board about the RSS but I wasn't able to, simply because the file in 1.4.9 is totally different from previous versions.

There is no logical explanation given for this at the moment, as internet becomes more integrated, websites must implement tools to follow this progress going on, otherwise...they will be always behind. And, in my case...I don't want that to happen.

I hope this answer helps.

Cheers.
Reply
#15
Anyone have the solution for 1.4.9?
Reply
#16
I willing this thing too.
[Image: 468x602b.png]
Reply
#17
See thread Latest Posts RSS Feed
Reply
#18
does it fetch all posts of a thread?
Reply
#19
I think the maximum is 100 recent posts.
Reply
#20
(2013-12-25, 10:07 AM)Prtik Wrote: I think the maximum is 100 recent posts.

100 posts of one thread would be awesome. Will give it a try.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)