News:

Wondering if this will always be free?  See why free is better.

Main Menu

RSS Feed Poster

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

Previous topic - Next topic

vbgamer45

hmm That shouldn't affect it though cause that code is the same code used in the cron and your not logged in with the cron
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

LP

I don't have time to test it at the moment, but I think if you add an 'ip' item to the $posterOptions array in Subs-RSS2.php (I will use 127.0.0.1), then it should work.  That is why it is failing as a scheduled task, Subs-Post is not getting a "poster_ip".  I don't really understand why.  It will run just fine if I check the box and hit Run Now in the Scheduled Tasks area but errors out otherwise.

vbgamer45

hmm that would explain a lot and why some people can't get it running.
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

LP

OK, I made changes to this section of Subs-RSS2.php:

$topicOptions = array(
'id' => 0,
'board' => $feed['ID_BOARD'],
'poll' => null,
'lock_mode' => $feed['locked'],
'sticky_mode' => null,
'mark_as_read' => false,
);
$posterOptions = array(
'id' => $feed['ID_MEMBER'],
'name' => $feed['postername'],
'email' => '',
'ip' => '127.0.0.1',
'update_post_count' => (($feed['ID_MEMBER'] == 0) ? 0 : 1),
);


I added the 'ip' line in the $posterOptions array.  I also set the value for 'mark_as_read' to false, because when it is set to true it causes another error.

The 'mark_as_read' error comes from this code in Subs-Post.php:

if (!empty($topicOptions['mark_as_read']) && !$user_info['is_guest'])
{
// Since it's likely they *read* it before replying, let's try an UPDATE first.
if (!$new_topic)
{
$smcFunc['db_query']('', '
UPDATE {db_prefix}log_topics
SET id_msg = {int:id_msg} + 1
WHERE id_member = {int:current_member}
AND id_topic = {int:id_topic}',
array(
'current_member' => $user_info['id'],
'id_msg' => $msgOptions['id'],
'id_topic' => $topicOptions['id'],
)
);

$flag = $smcFunc['db_affected_rows']() != 0;
}

if (empty($flag))
{
$smcFunc['db_insert']('replace',
'{db_prefix}log_topics',
array('id_topic' => 'int', 'id_member' => 'int', 'id_msg' => 'int'),
array($topicOptions['id'], $user_info['id'], $msgOptions['id'] + 1),
array('id_topic', 'id_member')
);
}
}


The thing to notice there is the $user_info['id'] that is used in two places.  That is not something that is passed from Subs-RSS2.php, so if it is run as a scheduled task or chron job there won't be any "user_info".  I'm not sure how to fix this other than turning off the mark_as_read flag.  Any ideas there?

LP

Quote from: LP on December 09, 2009, 01:05:13 PM
My feeds are being retrieved just fine, but some characters are being stripped from the URLs, especially ampersands (&).  This makes it so that the links do not work for the user to visit the origin page.  Any ideas?

Great mod, thanks!

BTW, in trying to fix this problem, I have determined that there is a problem with the version of libxml2 that is installed on my host.  As I do not have control over this, and they are unlikely to do anything about it, I put a workaround in the Subs-RSS2.php file to correct for ampersands, greater-than, and less-than:

$feeddata = GetRSSData($feed['feedurl']);

if ($feeddata != false)
{
$feeddata = str_replace('>','>',str_replace('<','<',str_replace('&','&',$feeddata)));

KirkhamsEbooks

New guy to RSS and php here

Can someone tell me what a fake cron job is? Do I need to click that for the RSS feed to work?

Rick

vbgamer45

2.1
Big Thanks to LP for this release for bug fixes and scheduled tasks support
!Fixed two bugs with feeds not being posted if run by cron job. IP Address
was required and mark_read needed to be false in order to work correctly
+Added task to scheduled task area for SMF 2.0
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

scimmiotto

this mod is imply great, i love all your mods...u are awesome man!!!
Loop code example:
The following statement is FALSE
The previous statement is TRUE.

vbgamer45

Quote from: KirkhamsEbooks on December 13, 2009, 12:51:43 AM
New guy to RSS and php here

Can someone tell me what a fake cron job is? Do I need to click that for the RSS feed to work?

Rick
A fake cron job basiclly runs when the page is loaded and checks if the feed bots are needed to be updated. We recommend using a real cron job or for SMF 2.0 using scheduled tasks instead.
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

scimmiotto

#1469
vbgamer, i've just tried your mod but, when the bot writes the message, it's full of unidentified tags, such as Div etc...and all the message is bad formatted...why?

see this topic for example

http://www.postimage.org/image.php?v=PqaFsH9
Loop code example:
The following statement is FALSE
The previous statement is TRUE.

vbgamer45

That feed contains html which caused that formatting to occur
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

scimmiotto

and what do to to make a correct formatted post?
Loop code example:
The following statement is FALSE
The previous statement is TRUE.

LP

scimmiotto, make sure you have activated the "HTML Enabled" checkbox in the "Edit Feed" dialog.  If that is not the problem, make sure that the member you have chosen to post the feed is an Administrator for your forum, as only Administrators are allowed to post html (they can use the html bbc tag).

scimmiotto

the HTML is enabled, and my newsbot is also administrator...but there's this error yet...where can i enable html in groups?
Loop code example:
The following statement is FALSE
The previous statement is TRUE.

scimmiotto

Loop code example:
The following statement is FALSE
The previous statement is TRUE.

LP

scimmiotto, try replacing your Subs-RSS.php and Subs-RSS2.php files in your Sources directory with these that I have attached.  I had a similar problem and fixed it with some edits.  I thought they were problems related to one particular feed I was using, perhaps the same problem appears in other feeds as well.

After you replace the files you will need to empty your forum's file cache (Admin > Maintenance > Forum Maintenance > Empty the file cache) before you try it.

scimmiotto

i'll try tnx.


Actually i use a NewsBot with admin privileges...must i activate the basics html tags in board and topic? or that settings are related to normal users?


tnx :)
Loop code example:
The following statement is FALSE
The previous statement is TRUE.

scimmiotto

Loop code example:
The following statement is FALSE
The previous statement is TRUE.

LP

#1478
You have removed guest access to that board, so I cannot see what is happening.


Edit:  Ah, I see you have just removed the topics so that your links no longer work.

LP

scimmiotto, this is what the feed http://feeds.feedburner.com/edilio looks like on my forum using the files I gave you:


http://i247.photobucket.com/albums/gg150/qwerty322/system/ScreenShot013.png


There are some characters that do not show correctly because my forum uses ISO-8859-1 instead of UTF-8.  I am currently working on a way to fix that on my forum.  The important thing is that the HTML is working correctly.

Advertisement: