Post Reply 
Petition to improve the RSS feeds
May. 04, 2009, 06:50 PM (This post was last modified: Dec. 08, 2011 11:22 PM by Kye-U.)
Post: #16
RE: Petition to improve the RSS feeds
I realize that the MyBB author(s) have updated the select query in syndication.php. I'll be working on fixing it.

EDIT: Done (I believe). Please verify that the RSS feeds are functioning the way they were before the upgrade Smile!

Some notes for myself (and anyone who is interested in modifying MyBB):

In syndication.php:

After:
Code:
$unviewable = '';

Add:
Code:
$unviewable2 = '';

After:
Code:
$unviewable .= " AND fid NOT IN($unviewableforums)";

Add:
Code:
$unviewable2 .= " AND p.fid NOT IN($unviewableforums)";

After:
Code:
$unviewable .= " AND fid NOT IN($inactiveforums)";

Add:
Code:
$unviewable2 .= " AND p.fid NOT IN($inactiveforums)";

After:
Code:
$forumlist = "AND fid IN ($forum_ids) $unviewable";

Add:
Code:
$forumlist2 = "AND p.fid IN ($forum_ids) $unviewable2";

After:
Code:
$forumlist = $unviewable;

Add:
Code:
$forumlist2 = $unviewable2;

Comment out (add // at the beginning):
Code:
$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));

Insert after:
Code:
$query = $db->query("
    SELECT t.tid, p.pid, t.subject
    FROM ".TABLE_PREFIX."posts p
    LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
    WHERE t.visible=1 AND t.closed NOT LIKE 'moved|%' ".$permsql." ".$forumlist2."
    ORDER BY p.pid DESC
    LIMIT 0,".$thread_limit
);

Remove (including the first comma):
Code:
,
"date" => $thread['dateline'],
"link" => $channel['link'].get_thread_link($thread['tid']),

Replace:
Code:
$firstposts[] = $thread['firstpost'];

With:
Code:
$firstposts[] = $thread['pid'];

Comment out:
Code:
$query = $db->simple_select("posts", "message, edittime, tid, fid", $firstpostlist, array('order_by' => 'dateline', 'order_dir' => 'desc'));

Insert after:
Code:
$query = $db->query("
        SELECT p.message, p.edittime, p.dateline, p.tid, p.pid, p.fid, u.username
        FROM ".TABLE_PREFIX."posts p
        LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
        WHERE ".$firstpostlist."
        ORDER BY p.pid DESC"
    );

Find:
Code:
$items[$post['tid']]['updated'] = $post['edittime'];

Add after:
Code:
$items[$post['tid']]['author'] = $post['username'];
$items[$post['tid']]['date'] = $post['dateline'];
$items[$post['tid']]['link'] = $channel['link'].get_thread_link($post['tid']).'&pid='.$post['pid'].'#pid'.$post['pid'];

And also follow through with the changes mentioned in Post #14.

Fix to make the Last Modified timestamp used as the date/time (if exists) in RSS:

In inc/class_feedgeneration, find:

Code:
$this->xml .= "\t\t\t<pubDate>".$item['date']."</pubDate>\n";

Replace with:

Code:
if($item['updated'])
                    {
                    $this->xml .= "\t\t\t<pubDate>".date("D, d M Y H:i:s O", $item['updated'])."</pubDate>\n";
                    } else {
                    $this->xml .= "\t\t\t<pubDate>".$item['date']."</pubDate>\n";
                    }
Visit this user's website
Add Thank You Quote this message in a reply
May. 04, 2009, 07:16 PM
Post: #17
RE: Petition to improve the RSS feeds
I'm getting this now at http://prxbx.com/forums/syndication.php?...0&limit=15 :
Quote:MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1052 - Column 'fid' in where clause is ambiguous
Query:
SELECT t.tid, p.pid, p.dateline,t.subject FROM mybb_posts p LEFT JOIN mybb_threads t ON (t.tid=p.tid) WHERE t.visible=1 AND t.closed NOT LIKE 'moved|%' AND fid NOT IN('2') ORDER BY p.pid DESC LIMIT 0,15
Add Thank You Quote this message in a reply
May. 04, 2009, 07:19 PM (This post was last modified: May. 04, 2009 07:25 PM by Kye-U.)
Post: #18
RE: Petition to improve the RSS feeds
There, should be fixed Smile!

EDIT: Realized the "author" value is empty, going to resolve this.
Visit this user's website
Add Thank You Quote this message in a reply
May. 04, 2009, 07:29 PM
Post: #19
RE: Petition to improve the RSS feeds
Was just going to say that.
It's the <name>...</name> tag for atom.
Add Thank You Quote this message in a reply
May. 04, 2009, 07:30 PM
Post: #20
RE: Petition to improve the RSS feeds
Does it display properly now?
Visit this user's website
Add Thank You Quote this message in a reply
May. 04, 2009, 07:32 PM
Post: #21
RE: Petition to improve the RSS feeds
Yep. The atom format is as it used to be. Smile!
Add Thank You Quote this message in a reply
May. 04, 2009, 07:35 PM (This post was last modified: May. 04, 2009 07:40 PM by sidki3003.)
Post: #22
RE: Petition to improve the RSS feeds
Ahh, no, two posts within one entry:
Code:
<entry xmlns="http://www.w3.org/2005/Atom">
        <author>
            <name>Kye-U</name>
        </author>
        <published>2009-05-04T13:50:43-05:00</published>
        <updated>2009-05-04T13:50:43-05:00</updated>
        <link rel="alternate" type="text/html" href="http://prxbx.com/forums/showthread.php?tid=1175&amp;pid=12263#pid12263" />
        <id>http://prxbx.com/forums/showthread.php?tid=1175&amp;pid=12263#pid12263</id>
        <title type="html" xml:space="preserve"><![CDATA[Petition to improve the RSS feeds]]></title>
        <content type="html" xml:space="preserve" xml:base="http://prxbx.com/forums/showthread.php?tid=1175&amp;pid=12263#pid12263"><![CDATA[Yep.  The atom format is as it used to be. <img src="http://prxbx.com/forums/images/smilies/smile.gif" style="vertical-align: middle;" border="0" alt="Smile!" title="Smile!" />]]></content>
        <draft xmlns="http://purl.org/atom-blog/ns#">false</draft>
    </entry>

edit: More a mixture of two posts...
edit2: More you as author in every name tag, lol.
Add Thank You Quote this message in a reply
May. 04, 2009, 07:43 PM (This post was last modified: May. 04, 2009 08:29 PM by Kye-U.)
Post: #23
RE: Petition to improve the RSS feeds
That was unintentional, I swear Wink

Looks like the code needs some major restructuring; I'll be messing around with the syndication file quite a bit for the next hour or so (depending on how well it goes).

EDIT: I guess it went pretty well; I hope it's fixed now.
EDIT 2: Fixed the issue with the post anchors being identical for each thread.
EDIT 3: Noticed the times are wrong...going to fix!
Visit this user's website
Add Thank You Quote this message in a reply
May. 04, 2009, 08:31 PM (This post was last modified: May. 04, 2009 08:34 PM by sidki3003.)
Post: #24
RE: Petition to improve the RSS feeds
Now all looks fine.

2 minutes ago i still got:
Error 1054 - Unknown column 't.fid' in 'where clause'

edit: times: ahh yes
Add Thank You Quote this message in a reply
May. 04, 2009, 08:39 PM (This post was last modified: May. 04, 2009 09:21 PM by Kye-U.)
Post: #25
RE: Petition to improve the RSS feeds
There, it should all be fixed. *crosses fingers*

EDIT: Made the RSS feed similar to the Atom feed in the way where it shows the last modified date/time instead of the original post time (if it exists).

I could make it so that the feeds are ordered by last modified date/time instead of original post time. This means that newly modified posts will appear as "new posts" (e.g. they'll be at the top). Is this preferable? Also, should the time format for the RSS feed be the same as Atom's?
Visit this user's website
Add Thank You Quote this message in a reply
May. 04, 2009, 09:45 PM
Post: #26
RE: Petition to improve the RSS feeds
(May. 04, 2009 08:39 PM)Kye-U Wrote:  I could make it so that the feeds are ordered by last modified date/time instead of original post time. This means that newly modified posts will appear as "new posts" (e.g. they'll be at the top). Is this preferable?

Sounds attractive to me. Smile!

(Still getting error 1054 now and then, BTW.)
Add Thank You Quote this message in a reply
May. 06, 2009, 01:42 PM
Post: #27
RE: Petition to improve the RSS feeds
(May. 04, 2009 09:45 PM)sidki3003 Wrote:  (Still getting error 1054 now and then, BTW.)
I got the error always.
Add Thank You Quote this message in a reply
May. 07, 2009, 12:17 PM
Post: #28
RE: Petition to improve the RSS feeds
For me:
Entirely functional when logged in.
Completely broken when not logged in.
Add Thank You Quote this message in a reply
May. 07, 2009, 01:40 PM
Post: #29
RE: Petition to improve the RSS feeds
Maybe in the new software are introduced some changes to don't see our own posts and it causes the problem. Don't know...
Add Thank You Quote this message in a reply
May. 07, 2009, 06:04 PM
Post: #30
RE: Petition to improve the RSS feeds
Is it fixed now? Smile!
Visit this user's website
Add Thank You Quote this message in a reply
Post Reply 


Forum Jump: