RSS Feed Poster

Started by SMFHacks.com Team, January 11, 2007, 07:46:04 PM

Previous topic - Next topic

margarett

#2940
Quote from: JTVaughn on September 22, 2015, 03:06:08 AM
No more ideas?
OK so I finally got the code in front :P

It is necessary to get a new query in order to get the topic's subject.
BTW, there's a bug in the code :P Line 828, it should be $feed['id_topic'], (and not $row) but this is not relevant for RSS ;)

I would suggest something like this: find
$msg_title = htmlspecialchars_decode($msg_title);
Replace with:

if (empty($feed['id_topic']))
$msg_title = htmlspecialchars_decode($msg_title);
else
{
$request_subject = $smcFunc['db_query']('', '
SELECT m.subject
FROM {db_prefix}topics as t
INNER JOIN {db_prefix}messages as m ON m.id_msg = t.id_first_msg
WHERE t.id_topic = {int:id_topic}
LIMIT 1',
array(
'id_topic' => $feed['id_topic'],
)
);
list($topic_title) = $smcFunc['db_fetch_row']($request_subject);
$smcFunc['db_free_result']($request_subject);

// If, for some reason, we can't have a subject, use the feed title
if (empty($topic_title))
$msg_title = htmlspecialchars_decode($msg_title);
else
$msg_title = $txt['response_prefix'] . $topic_title;
}

Warning: highly untested :P
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

JTVaughn

Parse error: syntax error, unexpected ')' in Subs-RSS2.php on line 365

margarett

Sorry, I had an extra comma in the line before. Fixed it now (I hope :P )
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

JTVaughn

Quote from: margarett on September 22, 2015, 09:33:16 AM
Sorry, I had an extra comma in the line before. Fixed it now (I hope :P )

It works :)

However, now the title of the RSS post has changed in the post itself. So instead of the blog post title at the top of the post, it says Re: Thread Title there too. It needs to use the topic subject as the subject, but keep the blog post in the post itself. I think it's this bit -

'body' => '[b]' . $msg_title . "[/b]\n\n" . $msg_body,

In the bold tags.

If you see what I mean.

margarett

#2944
Yeah, I see. Give me a second ;)

edit: Try this (you need to bring the edit a bit further down until $msgOptions)
$msg_title = htmlspecialchars_decode($msg_title);
if (!empty($feed['id_topic']))
{
$request_subject = $smcFunc['db_query']('', '
SELECT m.subject
FROM {db_prefix}topics as t
INNER JOIN {db_prefix}messages as m ON m.id_msg = t.id_first_msg
WHERE t.id_topic = {int:id_topic}
LIMIT 1',
array(
'id_topic' => $feed['id_topic'],
)
);
list($topic_title) = $smcFunc['db_fetch_row']($request_subject);
$smcFunc['db_free_result']($request_subject);

// If, for some reason, we can't have a subject, use the feed title
if (!empty($topic_title))
$msg_title2 = $txt['response_prefix'] . $topic_title;
}
$msg_body = htmlspecialchars_decode($msg_body);

$updatePostCount = (($feed['ID_MEMBER'] == 0) ? 0 : 1);

if ($feed['count_posts'] == 0)
$updatePostCount = 0;


$msgOptions = array(
'id' => 0,
'subject' => (!empty($msg_title2) ? $feed['topicprefix'] . $msg_title2 : $feed['topicprefix'] . $msg_title),
'body' => '[b]' . $msg_title . "[/b]\n\n" . $msg_body,
'icon' => $feed['msgicon'],
'smileys_enabled' => 1,
'attachments' => array(),
);
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

JTVaughn

Parse error: syntax error, unexpected ')' in Subs-RSS2.php on line 364 ;)

margarett

Same extra comma as before. Dummy me >:(
Fixed now ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

JTVaughn

haha, okay great, it's all working now. Had to add back in the hacks for post moderated replies and <br /> removal, but other than that your code works perfectly.


Quote from: JTVaughn on September 22, 2015, 07:08:06 AM
Let's put that one on the backburner for the moment.

The next issue I'm seeing is with Wordpress feeds.

The feed poster is grabbing and displaying both the description and the content when posting on the forum, in any scenario. I think this is because Wordpress uses different names for both so that the Wordpress blog owner can set which to use for RSS feeds.

<description><![CDATA[This is the short excerpt version that is a truncated version of the full post]]></description>
<content:encoded><![CDATA[This is the full post blah blah blah]]></content:encoded>

When you feed this through feedburner, and then check the source, you can see the <description> is green, like it's been commented out, and it wont be included. Which is correct. So the feedburner version of the Wordpress RSS displays correctly, but when you grab this using the SMF feed poster, it displays both everything in the <description> AND <content:encoded> tags.

However, with most other blogs/news sites, their RSS only uses one or the other. So you view the source, and everything is in <description> tags, or everything is in <content:encoded> tags, rather than both being in the source.

What's needed is for the feed poster to be aware of both <description> and <content:encoded> being in the source, and knowing when to only grab one or the other, instead of both.

As always, appreciate the help!

Now just bumping this problem back to the front

margarett

That... You need vbgamer ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

vbgamer45

I did look into in the last update just couldn't get that part to work.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

JTVaughn

This blog post talks about a fix for the description/content problem. It's probably not of any use, but I thought I'd pass it on http://drew5.net/code/windows-phone-app-studio-part-2-rss-reader-fix/

This page talks about description/content under the "5.2.1 content:encoded" section http://www.rssboard.org/rss-profile

machinenoob

Just installed this mod...pretty neat the only problem i am having is duplicates...how do u prevent duplicates??

vbgamer45

It should not post duplicates. It goes by the feed title and date as long as that is unique.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

machinenoob

Well so far i have added an rss for local news, a different sites rss for national, and an rss on anjob specific topic and all of them from diff sites have duplicates...not sure whats going on

vbgamer45

Not sure haven't seen that happened before...
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

machinenoob

yep just checked it again... i will pm links to screen shots, maybe its a setting, not sure....

ZamaTata

Thanks installed it and no errors ut I set it up to 30 minutes and 1 post .. It worked.. now I have changed to 100 posts but no luck in last 2 hours yet.. will see how it goes by tomorrow..


What does it mean by Use fake Cron jobs?

And Use description instead of content fieldt? how would I know I need to enable this options.

Thanks in advance

vbgamer45

Cron jobs should run every minute or couple minutes.
Fake cron jobs just run page load instead of a cron job.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

ZamaTata

Quote from: vbgamer45 on December 17, 2015, 12:55:18 PM
Cron jobs should run every minute or couple minutes.
Fake cron jobs just run page load instead of a cron job.

Thanks for the explanation.. and what about the Descritption instead of content bit?


vbgamer45

Uses the short description instead of the full content option
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Advertisement: