Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reversing the order of forum posts within a topic

  • Avatar of rossagrant
    rossagrant
    Participant

    @rossagrant

    Hi,

    I would like to reverse the page order of forum posts within a topic in order to have the first page as the most recent rather than having to navigate to the last page in order to read the latest posts.

    Is this possible?

    Thanks in advance,

    Ross :)

Viewing 9 replies - 1 through 9 (of 9 total)
  • Avatar of mrjarbenne
    mrjarbenne
    Participant

    @mrjarbenne

    This would be helpful on my site as well. Anyone know how to accomplish this

    Avatar of rossagrant
    rossagrant
    Participant

    @rossagrant

    Any ideas on this yet people?

    Avatar of dharmen99
    dharmen99
    Participant

    @dharmen99

    Yes, it would be a very useful option to be able to choose the the order of posts.

    Avatar of danbpfr
    danbpfr
    Participant

    @chouf1

    line 826 in bp-forums-templaetags.php
    change ASC to DESC

    Avatar of Virtuali
    Virtuali
    Participant

    @gunju2221

    Wouldn’t recommend at all changing the core, especially the templatetags.

    Just write a simple function using the templatetags.php in bp-custom something like:

    `function bp_has_forum_topic_posts() {
    global $topic_template;

    $defaults = array(
    ‘order’ => ‘DESC’

    }`

    not tested

    Avatar of peeld
    peeld
    Participant

    @peeld

    Code didn’t work, any plugin for this?

    Avatar of peeld
    peeld
    Participant

    @peeld

    Just wanted to see if somebody could help me out with the code above – I put it in bp-custom.php and it throws this error:

    `Fatal error: Cannot redeclare bp_has_forum_topic_posts() (previously declared in /home4/mysite/public_html/classroom/wp-content/plugins/bp-custom.php:60) in /home4/mysite/public_html/classroom/wp-content/plugins/buddypress/bp-forums/bp-forums-template.php on line 1131`

    Thanks much :)

    Avatar of @modemlooper
    @modemlooper
    Moderator

    @modemlooper

    Pass the ‘order’ parameter as DESC.

    if ( bp_has_forum_topic_posts( ‘order=DESC’ ) {

    The forum topic posts loop can be found in this template:
    /bp-default/groups/single/forum/topic.php

    Avatar of dylancasey
    dylancasey
    Participant

    @dylancasey

    I am trying to do exactly this: change the order of the posts displayed for a topic in a forum. I understand that I can do this by setting the ‘order’ parameter to DESC in bp_has_forum_topic_posts. What is eluding me is how to properly over-ride the function on my functions.php (or bp-custom.php) so as to just change the passed arguments.

    I’ve tried adding the following to my functions.php file (an it doesn’t work):

    function my_bp_has_forum_topic_posts($args) {
    $args = 'order=DESC';
    return $args;
    }
    add_filter( 'bp_has_forum_topic_posts','my_bp_has_forum_topic_posts');

    Thanks for the help in advance.

Viewing 9 replies - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.