Skip to:
Content
Pages
Categories
Search
Top
Bottom

Change "posting order"


  • BaraBajen
    Member

    @barabajen

    How do you change the order that replies ends up when reading a topic. Is it possible to change order of the replies, so that it shows the latest reply on top (reveresing order).

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

  • John James Jacoby
    Keymaster

    @johnjamesjacoby

    @BaraBajen – What version of bbPress are you using?


    BaraBajen
    Member

    @barabajen

    latest version, updated today


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Are you using the plugin version for WordPress, or did you install it as a stand-alone piece of software?


    BaraBajen
    Member

    @barabajen

    Ah, sorry

    Im using the plugin version – or atleast my question is concerning the plugin version


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    It would take a small plugin to piggy-back on top of bbPress. It would hook into the ‘bbp_has_replies_query’ filter, and switch the ‘order’ argument from ‘ASC’ to ‘DESC’.

    Or, you can drop something like this in your functions.php file. (Note: Not tested, so this code might not actually work.) :)


    function bbp_reverse_reply_order( $query = array() ) {

    // Bail if no query
    if ( empty( $query ) ) return;

    // Change the order
    $query = 'DESC';

    // Return the adjusted query
    return $query;
    }
    add_filter( 'bbp_has_replies_query', 'bbp_reverse_reply_order' );


    BaraBajen
    Member

    @barabajen

    Hmmm… slightly over my head (as it seems).

    Is it possible to have this an option in admin – to mark if you want to have a certain topic or forum showing the replies in reverse order.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Anything is possible, but that’s plugin territory.


    DuncanCox
    Member

    @duncancox

    I am using this bbpress from last 6 months still I have not found any plugin regarding this. if You find it then please share with me.


    AlexRayan
    Participant

    @alexrayan

    To whomever wonders how to switch the order of replies. This filter actually works well, just the code needs to be modified to change the array value in $query['order'].

    function bbp_reverse_reply_order( $query = array() ) {
        $query['order']='DESC';
        return $query;
    }
    add_fiter('bbp_has_replies_query','bbp_reverse_reply_order');
    

    Hope, it helps someone.

    Regards,
    Alex


    Tapirk
    Participant

    @tapirk

    Where do i put this filter. Now I’,m back to my mission again. Just had a short, one and half year brake. :-)

    @Tapirk You need to create a new custom plugin and then paste the function into it. The easiest way to create a new custom plugin is to use Pluginception.


    AlexRayan
    Participant

    @alexrayan

    @tapirk Alternatively, you can also put this function with the filter into your theme’s functions.php file in case you don’t want to create a plugin.

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

You must be logged in to reply to this topic.