Support Forum

Is it possible to have an RSS feed which displays topics only?

DI Duke Leto III
Duke Leto III
Member

Currently, the rss feeds show every post…. so when i have an rss feed watching a forum which has one busy thread, the feed has the same topic shown four times. 

Thanks!

19 Answers

New Answer

MP Mr Papa
Mr Papa
Member

not entirely sure I understand your use case here…  the feed will contain different posts within that topic…

but if I understand what you want, to your spFunctions.php theme template file, try adding:

add_filter('sph_post_list_query', 'my_rss_feeds', 10, 2);
function my_rss_feeds($spdb, $this) {
    global $sfvars;
    if ($sfvars['feed'] == 'forum') {
        $spdb->where.= ' AND '.SFPOSTS.'.post_id = (SELECT alt.post_id FROM '.SFPOSTS.' AS alt WHERE alt.topic_id = '.SFPOSTS.'.topic_id ORDER BY alt.post_id DESC LIMIT 1)';
    }
    return $spdb;
}
DI Duke Leto III
Duke Leto III
Member

Mr Papa, you seem to have understood perfectly! I didn’t want multiple posts from the same thread showing up in the feed. I had a topic, “Do you offer real music?”, and there were several replies. So my feed looked like: 

> Do you offer real music?

> Do you offer real music?

> Do you offer real music? 

I’m curious, is there something i can add to the code you provided to also work on group feeds? 

 

Thanks very much, sir!

 

edit: oh and one more question: is the spFunctions.php replaced often when updated? Is this something i can move to the theme i created, or should i just back up these changes and apply them when you put out new versions of Simple-Press?

MP Mr Papa
Mr Papa
Member

Yes, code can be added. What would you want it to do?

DI Duke Leto III
Duke Leto III
Member

Mr Papa said
Yes, code can be added. What would you want it to do?

It’d be nice to have the same functionality you wrote above apply to all feeds, including feeds for an entire group of forums. 

 

Also, did you see the question i edited in above? I want to make sure i know how to save these changes you’re helping me with, so when i update to newer versions of Simple-Press i don’t over-write them.

 

Thanks!

MP Mr Papa
Mr Papa
Member

yes, when wp updates a theme or plugin, it removes the previous theme or plugin before updating to the new one… so spFunctions.php will be overwritten on all theme updates…

see:  http://codex.simple-press.com/codex/themes/theme-basics/creating-a-theme/

will have to think on the group view rss feed…

DI Duke Leto III
Duke Leto III
Member

Mr Papa said
yes, when wp updates a theme or plugin, it removes the previous theme or plugin before updating to the new one… so spFunctions.php will be overwritten on all theme updates…

see:  http://codex.simple-press.com/codex/themes/theme-basics/creating-a-theme/

will have to think on the group view rss feed…

Thanks for the info! It turns out that I had already done that theme creations stuff when I first installed Simple Press, and I’m glad I did, because the filter you created for me above was already in the correct spFunctions.php file within my theme folder. 

Well done!

Have you perhaps thought of a way to apply the same filter concept to the group feed? You can look at my site’s footer for an example of where this is causing duplication: www.woodstockmediagroup.com

Thanks!

YS Yellow Swordfish
Yellow Swordfish
Member

Well I am not totally sure what Steve has done for you there but hey – if it works then great!

So why not try changing this to:

if ($sfvars['feed'] == 'forum' || $sfvars['feed'] == 'group') {

I don’t know if that will work because as I say, I am unsure at the moment how the first code works but it is maybe worth a try.

MP Mr Papa
Mr Papa
Member

would be interested if that worked…  first thing I tried was that and essentially locked up my system… hence my post about let me think about it… should work, and wanted to see what was going on with mine…  sorry, never got back to it… so yeah, please let me know…

DI Duke Leto III
Duke Leto III
Member

This didn’t lock anything up or break anything, but it also didn’t seem to do anything. It’s been a few hours and the problem remains. It is still fixed though in the forum feeds though. 

YS Yellow Swordfish
Yellow Swordfish
Member

I will go back to what Steve said above that this is something we will need to research and analyse…

DI Duke Leto III
Duke Leto III
Member

Yellow Swordfish said
I will go back to what Steve said above that this is something we will need to research and analyse…

Okay. Thanks for taking a look. 

I did try to saparate the rules from eachother and create two filters, one for group, and one for forum. This didn’t work, just thought i’d share. It actually prevented any page from loading. 

MP Mr Papa
Mr Papa
Member

probably be this weekend before I have a chance…  feel free to tweak us friday night if no progress yet…

DI Duke Leto III
Duke Leto III
Member

Did y’all ever have a chance to play around with this code?

YS Yellow Swordfish
Yellow Swordfish
Member

I know Steve has not forgotten. He is being slammed at work at the moment working lots of extra hours bit he is hooping to be though that pretty soon. If I have some time left over I will also try and take a look.