Skip to:
Content
Pages
Categories
Search
Top
Bottom

Sort topics in a Forum


  • koldogomez
    Participant

    @koldogomez

    Hi,

    I have some forums in my website. I want to sort the topics in a forum in a different manner than “last message” order. I have tried sort-topic-replies plugin but it does not give me a solution to my problem.

    I hope you could find the way to fix this issue. Thanks a lot.

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

  • Robin W
    Moderator

    @robin-w

    can you say what order you would like them sorted into?


    koldogomez
    Participant

    @koldogomez

    I would like to sort topic in an alphabetical way or depending the date of the topic was created.

    Thanks a lot


    Robin W
    Moderator

    @robin-w

    date order:

    put this in your functions fil :

    function rew_date_topic_order( $args ) {
                    $args['orderby']='date';
                    $args['order']='DESC';  //change to ASC to put oldest at top
                    return $args;
    }
    add_filter('bbp_before_has_topics_parse_args','rew_date_topic_order');

    Functions files and child themes – explained !


    Zomak
    Participant

    @zomak

    Is it possible to use this for only one out of 4 forums?

    I would like 3 of the forums to have the topic with the newest reply on top, but one I would like to have it in order of topic creation.

    Greetings,
    Sam


    Robin W
    Moderator

    @robin-w

    yes, install my bbp style pack and go to

    dashboard>settings>bbp style pack>Topic Order

    where you van set a default order, and then another order for specific forum(s)


    vorahasti
    Participant

    @vorahasti

    Hey,
    I have to sort the replies of the forum topics.
    I want latest replies to be shown first. Please help me.
    Is there any way I can implement this?

    Thankyou


    Robin W
    Moderator

    @robin-w

    bbp style pack

    once activated go to

    dashboard>settings>bbp style pack>topic order


    vorahasti
    Participant

    @vorahasti

    I have to sort topics and replies in bbpress forum changing code how can I do it?


    vorahasti
    Participant

    @vorahasti

    what I have to edit in bbp style pack to get that latest replies first? I selected decending but its not changing


    Robin W
    Moderator

    @robin-w

    so not the order the topics show in the forum list – BUT the replies to a specific topic to show first – yes ?


    vorahasti
    Participant

    @vorahasti

    yes I want latest replies to be shown first


    Robin W
    Moderator

    @robin-w

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

    where %your-theme-name% is the name of your theme

    or use

    Code Snippets

    add_filter('bbp_has_replies_query', 'rew_modify_replies_query');
    
    function rew_modify_replies_query($bbp_r) {
    $bbp_r['order'] = 'DESC';
    return $bbp_r;
    }
    
    add_filter('bbp_show_lead_topic', 'rew_show_lead_topic');
    
    function rew_show_lead_topic () {
    	return true ;
    }

    vorahasti
    Participant

    @vorahasti

    Thankyou So Much ! It worked for me! Finally got sorted list without plugin.


    Robin W
    Moderator

    @robin-w

    great – glad you are fixed


    sblwp
    Participant

    @sblwp

    Hello Robin,

    Thank you for the help you offer.

    I tried the code in the child theme’s function file and it works fine to re-order the replies… BUT I have 3 issues :
    – The link given in the recent activity widget leads to the last page of the topic… now being the beginning, so not the last reply
    – Same problem for the link in the email notification
    – and when we post a reply, the page refresh leads to the beginning of the topic too so you don’t see you answer published unless you click on the right page number or scroll back to the top.
    These 3 situations imply too much confusion for the users so I choose to not use the code but don’t find another solution.

    I’m surprised no plugin exists for this ( part from “bbPress – Sort topic replies ” which is not maintained so I didn’t try it worried to get security problems).

    Do you think of a way to fit the issues generated with the descending order or do you consider it is too much of “torsion” of the system ?

    Thanks again.
    Sophie


    Robin W
    Moderator

    @robin-w

    I’ve taken a look, and yes lots of code changes to get replies in reverse order, and currently too much of a challenge to try and do !

    Sorry !

Viewing 16 replies - 1 through 16 (of 16 total)
  • You must be logged in to reply to this topic.
Skip to toolbar