[2.0.6] RSS Content Syndicator

The cleanup is complete. This forum is now read only.
Post Reply

Rating:

Excellent!
119
64%
Very Good
41
22%
Good
13
7%
Fair
5
3%
Poor
7
4%
 
Total votes: 185

nschindler
Registered User
Posts: 101
Joined: Tue Jun 17, 2003 12:24 am
Location: Los Angeles, CA, USA
Contact:

Post by nschindler » Wed Dec 17, 2003 6:32 pm

gr00vy0ne wrote:
nschindler wrote:
rabidgopher04 wrote:Hi, I just noticed something about this MOD. It only displays new topics and not if there is a new post nor moves the topic with a new post to the top of the list. Is there a way this feature could be added as an option?

Let me know if you need more clarification or if this was not within the scope of the project. Thanks :)


by default, it displays new posts. it only displays 'start of topic' posts when you call it as "rss.php?t=1". the newest item should be at the top of the list.
if this isn't your experience, please clarify... i'm confused.


I think I have a similar problem. Basically, it's returning way too many items. In some cases I get duplicates.

So, whenever one person replies to any given post instead of getting that latest reply in the RSS feed, I get the latest reply PLUS all the other entries before it. How can I get it to only show the latest reply only?


Okay, here's a patch to make it show only the last post from your topics:

open rss.php
find:

Code: Select all

$sql = "SELECT f.forum_name, t.topic_title, u.user_id, u.username, u.user_sig, u.user_sig_bbcode_uid, p.post_id, pt.post_text, pt.post_subject, pt.bbcode_uid, p.post_time, t.topic_replies, t.topic_first_post_id
replace with:

Code: Select all

$sql = "SELECT f.forum_name, t.topic_title, u.user_id, u.username, u.user_sig, u.user_sig_bbcode_uid, p.post_id, pt.post_text, pt.post_subject, pt.bbcode_uid, p.post_time, t.topic_replies, t.topic_first_post_id, t.topic_last_post_id
then find:

Code: Select all

AND p.topic_id = t.topic_id
add below:

Code: Select all

AND pt.post_id = t.topic_last_post_id
save/close rss.php

let me know if you have any problems with it...

blacklily8
Registered User
Posts: 14
Joined: Sun Oct 05, 2003 7:06 pm

Post by blacklily8 » Wed Dec 17, 2003 7:00 pm

netclectic wrote:
after a quick look at the code, you could change this:
Code:
$forum_id = ( isset($HTTP_GET_VARS['f']) ) ? intval($HTTP_GET_VARS['f']) : '';
$sql_forum_where = ( !empty($forum_id) ) ? ' AND f.forum_id = ' . $forum_id : ' ';


to

Code:
$forum_id = ( isset($HTTP_GET_VARS['f']) ) ? htmlspecialchars($HTTP_GET_VARS['f']) : '';
$sql_forum_where = ( !empty($forum_id) ) ? ' AND f.forum_id IN [ ' . $forum_id . ']': ' ';
which would let you use ?f=1,2,3,4


I guess I must have missed something somewhere along the line. Where do I plug in the forum IDs? Everytime I try to plug anything in between the ' ' at the end, I get a mysql error.

nschindler
Registered User
Posts: 101
Joined: Tue Jun 17, 2003 12:24 am
Location: Los Angeles, CA, USA
Contact:

Post by nschindler » Wed Dec 17, 2003 7:16 pm

blacklily8 wrote:
netclectic wrote:
after a quick look at the code, you could change this:
Code:
$forum_id = ( isset($HTTP_GET_VARS['f']) ) ? intval($HTTP_GET_VARS['f']) : '';
$sql_forum_where = ( !empty($forum_id) ) ? ' AND f.forum_id = ' . $forum_id : ' ';


to

Code:
$forum_id = ( isset($HTTP_GET_VARS['f']) ) ? htmlspecialchars($HTTP_GET_VARS['f']) : '';
$sql_forum_where = ( !empty($forum_id) ) ? ' AND f.forum_id IN [ ' . $forum_id . ']': ' ';
which would let you use ?f=1,2,3,4


I guess I must have missed something somewhere along the line. Where do I plug in the forum IDs? Everytime I try to plug anything in between the ' ' at the end, I get a mysql error.


in the URL... look at your address bar right now. see "http://www.phpbb.com/phpBB/viewtopic.php?[...]"
well, everything after the question mark are arguments for the php script to parse. rss.php works the same way. you can say "http://<your domain>/phpBB2/rss.php?f=1" (or if you use netclectic's improvement, "rss.php?f=1,2,3[,etc.]") to display only certain forums. Obviously, you'll have to know the forum ID of the forum you want to view in the feed. If you don't know the forum ID, just guess at it. Let trial and error be your guide. :)
I don't think there's a place in the ACP where it relates forum IDs to forum descriptions.

read rss.MOD.txt (it came with the MOD), it explains what arguments are currently available for rss.php, an their syntax.

blacklily8
Registered User
Posts: 14
Joined: Sun Oct 05, 2003 7:06 pm

Post by blacklily8 » Wed Dec 17, 2003 7:28 pm

This is what I get everytime I try it:
Could not query list of active posts

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '[ 23] ORDER BY p.post_time DESC LIMIT 15' at line 10

SELECT f.forum_name, t.topic_title, u.user_id, u.username, u.user_sig, u.user_sig_bbcode_uid, p.post_id, pt.post_text, pt.post_subject, pt.bbcode_uid, p.post_time, t.topic_replies, t.topic_first_post_id FROM phpbb_forums AS f, phpbb_topics AS t, phpbb_users AS u, phpbb_posts AS p, phpbb_posts_text as pt WHERE t.forum_id = f.forum_id AND f.auth_view = 0 AND p.poster_id = u.user_id AND pt.post_id = p.post_id AND p.topic_id = t.topic_id AND f.forum_id IN [ 23] ORDER BY p.post_time DESC LIMIT 15

Line : 165
File : /home/mattbart/public_html/phpBB2/rss.php

nschindler
Registered User
Posts: 101
Joined: Tue Jun 17, 2003 12:24 am
Location: Los Angeles, CA, USA
Contact:

Post by nschindler » Wed Dec 17, 2003 8:05 pm

blacklily8 wrote: This is what I get everytime I try it:
Could not query list of active posts

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '[ 23] ORDER BY p.post_time DESC LIMIT 15' at line 10

SELECT f.forum_name, t.topic_title, u.user_id, u.username, u.user_sig, u.user_sig_bbcode_uid, p.post_id, pt.post_text, pt.post_subject, pt.bbcode_uid, p.post_time, t.topic_replies, t.topic_first_post_id FROM phpbb_forums AS f, phpbb_topics AS t, phpbb_users AS u, phpbb_posts AS p, phpbb_posts_text as pt WHERE t.forum_id = f.forum_id AND f.auth_view = 0 AND p.poster_id = u.user_id AND pt.post_id = p.post_id AND p.topic_id = t.topic_id AND f.forum_id IN [ 23] ORDER BY p.post_time DESC LIMIT 15

Line : 165
File : /home/mattbart/public_html/phpBB2/rss.php


try this:

Code: Select all

$forum_id = ( isset($HTTP_GET_VARS['f']) ) ? htmlspecialchars($HTTP_GET_VARS['f']) : '';
$sql_forum_where = ( !empty($forum_id) ) ? ' AND f.forum_id IN (' .  forum_id . ')': ' ';

blacklily8
Registered User
Posts: 14
Joined: Sun Oct 05, 2003 7:06 pm

Post by blacklily8 » Wed Dec 17, 2003 8:37 pm

Thanks. Unfortunately, now I get this error:
Could not query list of active posts

DEBUG MODE

SQL Error : 1052 Column: 'forum_id' in where clause is ambiguous

SELECT f.forum_name, t.topic_title, u.user_id, u.username, u.user_sig, u.user_sig_bbcode_uid, p.post_id, pt.post_text, pt.post_subject, pt.bbcode_uid, p.post_time, t.topic_replies, t.topic_first_post_id FROM phpbb_forums AS f, phpbb_topics AS t, phpbb_users AS u, phpbb_posts AS p, phpbb_posts_text as pt WHERE t.forum_id = f.forum_id AND f.auth_view = 0 AND p.poster_id = u.user_id AND pt.post_id = p.post_id AND p.topic_id = t.topic_id AND f.forum_id IN (forum_id) ORDER BY p.post_time DESC LIMIT 15

Line : 166
File : /home/mattbart/public_html/phpBB2/rss.php

nschindler
Registered User
Posts: 101
Joined: Tue Jun 17, 2003 12:24 am
Location: Los Angeles, CA, USA
Contact:

Post by nschindler » Wed Dec 17, 2003 8:48 pm

blacklily8 wrote: Thanks. Unfortunately, now I get this error:

Could not query list of active posts

DEBUG MODE

SQL Error : 1052 Column: 'forum_id' in where clause is ambiguous

SELECT f.forum_name, t.topic_title, u.user_id, u.username, u.user_sig, u.user_sig_bbcode_uid, p.post_id, pt.post_text, pt.post_subject, pt.bbcode_uid, p.post_time, t.topic_replies, t.topic_first_post_id FROM phpbb_forums AS f, phpbb_topics AS t, phpbb_users AS u, phpbb_posts AS p, phpbb_posts_text as pt WHERE t.forum_id = f.forum_id AND f.auth_view = 0 AND p.poster_id = u.user_id AND pt.post_id = p.post_id AND p.topic_id = t.topic_id AND f.forum_id IN (forum_id) ORDER BY p.post_time DESC LIMIT 15

Line : 166
File : /home/mattbart/public_html/phpBB2/rss.php


even if you request only one forum id?

blacklily8
Registered User
Posts: 14
Joined: Sun Oct 05, 2003 7:06 pm

yup

Post by blacklily8 » Wed Dec 17, 2003 8:54 pm


nschindler
Registered User
Posts: 101
Joined: Tue Jun 17, 2003 12:24 am
Location: Los Angeles, CA, USA
Contact:

Re: yup

Post by nschindler » Wed Dec 17, 2003 8:58 pm

blacklily8 wrote: Yes. Try it yourself:

http://mattbarton.net/phpBB2/rss.php?f=3


I can give it multiples (f=1,2) but not only one. I didn't actually test it with only one when posted that last patch. *shrug*
so, you can use the original code to select only one,
or you can use the modified code to select multiples. as soon as i have time, i'll look into making it work both ways.

blacklily8
Registered User
Posts: 14
Joined: Sun Oct 05, 2003 7:06 pm

Post by blacklily8 » Thu Dec 18, 2003 12:21 am

I don't get it. I can't get it to give me anything if I include ?f in the url. All I can do is run the default rss.php to get the feed; any attempts to limit it to one forum or several results in a mysql error.

nschindler
Registered User
Posts: 101
Joined: Tue Jun 17, 2003 12:24 am
Location: Los Angeles, CA, USA
Contact:

Post by nschindler » Thu Dec 18, 2003 12:41 am

blacklily8 wrote: I don't get it. I can't get it to give me anything if I include ?f in the url. All I can do is run the default rss.php to get the feed; any attempts to limit it to one forum or several results in a mysql error.


so when you go to http://www.mattbarton.net/phpBB2/rss.php?f=2 you get an error? I get items from "Classroom Questions & Issues". Forum 1 seems to be hidden, but I can ask it for f=2 or f=3 and it works.... well, it did a second ago. looks like you're playing with the code at the moment.

blacklily8
Registered User
Posts: 14
Joined: Sun Oct 05, 2003 7:06 pm

errors

Post by blacklily8 » Thu Dec 18, 2003 12:44 am

Well, I went back and put in the original code, and found I could select particular forums. However, when I put in the new code, I could not select multiple forums; I just got the error.

nschindler
Registered User
Posts: 101
Joined: Tue Jun 17, 2003 12:24 am
Location: Los Angeles, CA, USA
Contact:

Re: errors

Post by nschindler » Thu Dec 18, 2003 12:54 am

blacklily8 wrote: Well, I went back and put in the original code, and found I could select particular forums. However, when I put in the new code, I could not select multiple forums; I just got the error.


reference the post I left earlier - http://www.phpbb.com/phpBB/viewtopic.ph ... 859#895859

I think I only changed netclectic's patch to use perentheses around f.forum_id, instead of using brackets. that seems to work, but only for selecting multiple forums.. not for selecting only one forum. my original code only works for selecting single forums.

Like I said, when I get a chance, I'll get it to work both ways.

blacklily8
Registered User
Posts: 14
Joined: Sun Oct 05, 2003 7:06 pm

Post by blacklily8 » Thu Dec 18, 2003 7:08 pm

Okay, I got it to work with the parantheses instead of the brackets. One small victory!

However, there is another problem. Is there a way that I can automatically abbreviate the feeds? I tend to write really long posts, and it's dominating the "News" site where I placed the feed. Is there a way to limit the size of each post, perhaps to a specified word or line count?

Let me know. I thought the "topics" option was to limit the feed to simply the titles of topics, not the whole posts.

TheMusicMan
Registered User
Posts: 501
Joined: Mon Oct 14, 2002 9:25 pm
Location: South Wales, UK
Contact:

Post by TheMusicMan » Thu Dec 18, 2003 7:19 pm

Sorry folks, can I ask a really dumb question. I'd like to use this MOD which I assume os for showing my latest posts on other sites yeah? If so, how do I use it? :?
John

Post Reply

Return to “[2.0.x] MOD Database Cleanup”