Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Order RSS by most recent Discussion date (not most recent comment date)?

I linked up [myforumurl]/discussions/feed.rss to feedburner. Users are confused. Vanilla is ordering the feeds by latest COMMENT date, not latest discussion date. In other words, a discussion from 2 years ago is showing up as the "latest" discussion simply because someone commented on it today.

I checked out the raw RSS feed in my browser and the same issue comes up - the top discussions in the feed are not the newest discussions.

Is there any way to change the behavior of feed.rss so it behaves more like a traditional RSS feed -- showing the latest discussions first?

Comments

  • I also tried http://www.mysite.com/discussions.xml/1-10/ but the behavior is the same (shows old discussions as "latest" discussions)

  • hgtonighthgtonight ∞ · New Moderator
    edited March 2014

    You are looking to change the sort field, check out this discussion here: http://vanillaforums.org/discussion/comment/180112/#Comment_180112

    Let me know if that works for you.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • @hgtonight I did indeed see your post before and it worked. The problem is, that threw off the whole site, so every category was ordered by date discussion was inserted. I am just looking for a way to have a feed ordered by date discussion inserted.

  • Maybe there is a feed parser out there that is smarter than feedburner. But feedburner can't figure it out based on the feed provided.

  • hgtonighthgtonight ∞ · New Moderator

    This is somewhat of a pickle. You would want to hook into the discussion model to change the sort, but the controller is what knows what the delivery method is.

    I don't have a codebase in front of me at the moment, so I can't really help.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • I think the bigger problem here is that the users are expecting a front page that lists the discussions by the date the discussion was inserted, not the default Vanilla behavior (date the last comment was inserted). I suspect the best way to fix this is write a custom function that is based off of the Vanilla "discussion model" and then call that function on a new page?

  • hgtonighthgtonight ∞ · New Moderator

    @gharald said:
    I think the bigger problem here is that the users are expecting a front page that lists the discussions by the date the discussion was inserted, not the default Vanilla behavior (date the last comment was inserted).

    I don't really care when someone started a discussion, just when the last person was talking about it. If you want to sort the discussion list site wide, follow the previous link. If you want just a feed that is sorted this way, you can hook in and do that via a plugin.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • @hgtonight said:
    I don't really care when someone started a discussion, just when the last person was talking about it.

    We have two classes of users: those who think like you do, and those who are perhaps more casual users and are bewildered that they no longer have a blog-like front page that lists the discussions chronologically. So that's why we do not want the whole site to be sorted that way.

    If I was to write a plugin to create a blog-like front page (which is a bit beyond my current abilities, at least as of today) is there a good starting point you could recommend? Would I take an existing function and rewrite it?

    I did try the "Nillablog" plugin, but that plugin only allows you to pick categories that you want to display in "blog-like" fashion. I suppose there is maybe a way to hack it...

  • hgtonighthgtonight ∞ · New Moderator
    edited March 2014

    If you are looking for a blog application, I highly suggest checking out @Shadowdare‌'s Articles application proposal. I personally started using NillaBlog but ended up writing my own that does some nice stuff with the modules. I didn't release it because I think it is a little rough, but it is called BlanderBlog and you can find it on my GitHub.

    If you want to create a new "view" like discussions/bydate that would be pretty easy to do via a plugin. This hook will temporarily override the configured sort field and direction:

    public function DiscussionsController_ByDate_Create($Sender) {
      // Get a copy of the configuration object and temporarily override the sort options
      $Config = Gdn::Config();
      $Config->Set('Vanilla.Discussions.SortField', 'd.DateInserted', TRUE, FALSE);
      $Config->Set('Vanilla.Discussions.SortDirection', 'desc', TRUE, FALSE);
    
      // Do everything else the same as the index method
      $Sender->View = 'index';
      $Sender->Index();
    }
    

    Not sure where to put this? Add it to your theme hooks file, or create a simple plugin to put it in.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • omigosh, it's like magic! Thank you. Vanilla is so powerful... yet so mysterious. @hgtonight I hope one day I have your ninja skills.

Sign In or Register to comment.