PDA

View Full Version : replace words in rss


yjeanrenaud
10-19-2013, 09:28 PM
Hi
I would like to do certain replacements in the xml rss feed for convenience of the subscribers. I therefore had a look at the external.php and thought, if I load a list of replacements and just parse the variale $output at the end of the script, right before echo $output; it should be enough. but it's not. any clues?

kh99
10-19-2013, 09:42 PM
The output is cached, so maybe it didn't work because of that. The setting External Data Provider > Thread Cache Lifespan controls how long things are cached, but I don't know if you can turn it off by using 0 (the instructions don't mention it). You could either set it to 1 minute and wait between tests, or figure out where in the database it's stored and truncate the table between tests.

ETA: I guess it's the "externalcache" table.

yjeanrenaud
10-20-2013, 06:50 PM
Ah I see, thanks for the tip. But $output should be the way to go, yes?

kh99
10-20-2013, 06:56 PM
Yes, you should be able to do it by changing $output. If you're interested in doing it in a plugin, you could use hook external_complete.

ETA: and even if you don't want to use a plugin, you'll want to do your replace before the cache is written (which happens just after the hook is called).

yjeanrenaud
10-21-2013, 05:17 PM
thanks alot!
is there any way to make these changes conditionally via plugin so not everyone gets the changes?

kh99
10-22-2013, 10:26 AM
Well, you can't really do it by vbulletin user or group because the external.php script doesn't check for users logged in (you can see at the top of external.php it defines SKIP_SESSIONCREATE, which means it doesn't try to determine in the user is logged in). You could remove that but you'd add overhead to each call to the feed, and anyone who got the feed who wasn't logged in would show up as a guest on your forum. Also, if a member wanted to get the feed using a reader other than their browser, they wouldn't appear as a logged in user.

I hope that makes sense. I'm not sure exactly what your situation is, but maybe you could give some users a different url (with an added parameter or something), then check for that.