We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

[Solution available] Forum: most recent post first | Forum

Niels
Niels Nov 3 '11

Hi,

First of all: great work so far! Creating my site with Oxwall worked great and the members of it are really happy with it.

My question: is it possible to reverse the order in witch the forummessages are displayed? We would prefer the most recent message on top and the oldest at the bottom.

Thanks!

The Forum post is edited by Alia May 18 '15
Max
Max Nov 3 '11
Hi
Forum works already as you describe. But if someone post on an old post, the old post will be displayed on top
Niels
Niels Nov 3 '11

I think you mean the overview of the topics, indeed in that case  the most recent topic is on top. But I mean the messages *inside* a topic, these are numbered message #1 to message #last (in the rightside corner of each message) and these are displayed with the oldest on top. See for example this topic where you are reacting on my question. My question is older, your reaction is placed *under* my question and the reaction I'm writing right now will be placed *under* youre answer. We would like to reverse this order.

The Forum post is edited by Niels Nov 3 '11
Max
Max Nov 3 '11
Hmm
I think it's not a good idea but it's your choice :)

Try this :
In \ow_plugins\forum\bol\topic_dao.php
Replace all the :

`createStamp` DESC
By
`createStamp` ASC

3 times I think..
Niels
Niels Nov 3 '11
Well, it's a matter of what people are used too.. One of the main Dutch social networks (Hyves) gives users the choice wheter they want it descending or ascending. Most members of my site come from there and want it this way..;-)

Thanx for the reply, I'm gonna try it!!

Edit: this modifies the topiclist (indeed, it's reversed!) but *not* the messages *inside* a topic. At least, I know in what direction I have to search
The Forum post is edited by Niels Nov 3 '11
Niels
Niels Nov 3 '11
I think I have to look in one of the post_*.php files, but wich? (and where? ;-) )
Niels
Niels Nov 15 '11

OK: this is how far I got:

In the post_DAO.php file there's a function "findTopicPostList". When I change the line

$example->SetOrder('`id`')

to

$example->SetOrder('`id` DESC')

all the posts in one topic are displayed reversed, exactly the way I want it -OK, the members of my site want it... :(  

So far, so good.

But when I hit the "Edit"-button the wrong post is edited. For example, when I want to edit the most recent post, the oldest is edited instead. It looks like the relation between the post-ID and the post itself doesn't get reversed. Any idea how to fix this?

Michael I.
Michael I. Dec 20 '12
Topic was moved from Plugins.
Marcel
Marcel May 16 '15
I have the same problem

dave Leader
dave May 17 '15
Yes sounds like there are two dif arrays one for view and one for edit, you have set the view array correctly but not the edit array to also be DESC.  Which is strange because it should be editing by ID regardless of sort order. 
The Forum post is edited by dave May 17 '15
Alia Team
Alia May 18 '15
You must also set "desc" order for findTopicFirstPost method ( in addition to findTopicPostList).

    public function findTopicFirstPost( $topicId )
    {
        $example = new OW_Example();
        $example->andFieldEqual('topicId', $topicId);
        $example->setOrder("`id` desc");
        $example->setLimitClause(0, 1);
        return $this->findObjectByExample($example);
    }
Marcel
Marcel May 18 '15
Thanks it works now
matt
matt Jun 17 '15
Hi,

We found one issue with this hack.

If you have a topic with enough posts to cause pagination, after submitting a new reply, you will get redirected to the last page of the forum posts (the page with the first posts on).

If we are reversing the forum to show newest posts, at the top. Then we would expect (want) to get re-directed to the newest post on the newest page.

Can someone confirm how to deal with the post submit redirection?
matt
matt Jul 2 '15
Anyone?
Alia Team
Alia Jul 3 '15
Matt, unfortunately further modifications ( described in your last reply) require more advanced programming skills and as support operator I can not assist with modifications of this complexity level.

Hopefully other community members will have a solution to this.
matt
matt Aug 1 '15
Sure, Thanks Alia. I think we can agree that I understand your stock replies. And so perhaps we can also assume that I am not speaking to you, but others in the community.

FYI - the solution offered is partial, or incomplete - so perhaps mark the thread accordingly?

The solution above has a few problems.

The post numbering that appears under the post, numbers the top (latest) post as  #1. Which of course it isn't. The first post made (the oldest post) should be #1. And the post count should increment accordingly.

As well as my above noted, after post action, that returns the user to the wrong screen.

I will try and work on these and post back any responses, in case anyone is interested.

I also added an anchor and link, so that users reading the lates post (at the top of the post list) can click a 'reply' link and get taken to the jhtml post box.


The Forum post is edited by matt Aug 1 '15