FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » FUDforum Suggestions » User selectable post order
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
User selectable post order [message #19947] Fri, 17 September 2004 19:04 Go to next message
hari is currently offline  hari   United States
Messages: 23
Registered: November 2003
Location: Los Angeles, California, ...
Karma: 0
Junior Member
I don't see this as an option currently ... some of my users would prefer to have the list of posts under a topic in reverse chronological order (newest posts at top).

Would it be possible to have a user set the preferred sort order in his/her preferences? I know I can probably change the SQL query to return posts in whatever order I want, but that would have to apply for everybody.

Re: User selectable post order [message #19952 is a reply to message #19947] Sat, 18 September 2004 20:22 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Well, if you are customizing the forum you can just add this option to the user control panel and based on that control panel modify the query.

In fact you can use users_opt field in the users tables to store this setting.


FUDforum Core Developer
Re: User selectable post order [message #22393 is a reply to message #19952] Tue, 01 February 2005 10:28 Go to previous messageGo to next message
bobby is currently offline  bobby   Ukraine
Messages: 14
Registered: January 2005
Karma: 0
Junior Member
Are you planing to add this (selectable post order) feature? I'm sure it is very important thing for many people.
Re: User selectable post order [message #22402 is a reply to message #22393] Tue, 01 February 2005 15:26 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
not at this time.

FUDforum Core Developer
Re: User selectable post order [message #24347 is a reply to message #22402] Mon, 25 April 2005 12:49 Go to previous messageGo to next message
jonmoss is currently offline  jonmoss   United States
Messages: 93
Registered: September 2004
Location: Lansing, KS
Karma: 0
Member

I have requests from several of my users to have topics listed in reverse chronological order.

Since there is no plan to include this as an admin configuration option on a forum nor as a user preference, please let me know where the code is so I can change the order on the select statement?

This refers to post sort order within a topic, not forum sort order of topics (which already defaults to reverse chronological sort order).


Thanks and have a great day!

Jon Moss

[Updated on: Mon, 25 April 2005 13:17]

Report message to a moderator

Re: User selectable post order [message #24351 is a reply to message #24347] Mon, 25 April 2005 14:38 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
The two scripts you need to look @ are msg.php.t and tree.php.t. The main message retreival query (biggest query in both files) is the one who's ORDER BY clause you want to modify.

FUDforum Core Developer
Re: User selectable post order [message #24361 is a reply to message #24351] Mon, 25 April 2005 18:23 Go to previous messageGo to next message
jonmoss is currently offline  jonmoss   United States
Messages: 93
Registered: September 2004
Location: Lansing, KS
Karma: 0
Member

Thanks very much! I'll give it a shot.


Thanks and have a great day!

Jon Moss
Re: User selectable post order [message #24363 is a reply to message #24361] Mon, 25 April 2005 18:48 Go to previous messageGo to next message
jonmoss is currently offline  jonmoss   United States
Messages: 93
Registered: September 2004
Location: Lansing, KS
Karma: 0
Member

Oh this is awful!

I edited the msg.php.t found in the src folder and rebuilt the theme from Admin Control Panel.

Now the flat view is not working at all!

I even went back and re-edited it to put it back the way it was and rebuilt the theme again.

Still no flat view!

ARGH!

What do I do now?


Thanks and have a great day!

Jon Moss

[Updated on: Mon, 25 April 2005 18:48]

Report message to a moderator

Re: User selectable post order [message #24364 is a reply to message #24363] Mon, 25 April 2005 18:59 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
You download msg.php.t from the CVS (via web cvs) and replace the one you may have broken.

FUDforum Core Developer
Re: User selectable post order [message #24365 is a reply to message #24364] Mon, 25 April 2005 19:04 Go to previous messageGo to next message
jonmoss is currently offline  jonmoss   United States
Messages: 93
Registered: September 2004
Location: Lansing, KS
Karma: 0
Member

I was able to restore that file from another place on my server.

What is the link to web cvs?

Thanks,

Jon


Thanks and have a great day!

Jon Moss
Re: User selectable post order [message #24366 is a reply to message #24365] Mon, 25 April 2005 19:07 Go to previous messageGo to next message
jonmoss is currently offline  jonmoss   United States
Messages: 93
Registered: September 2004
Location: Lansing, KS
Karma: 0
Member

Never mind, I found the post about CVS access. I just wanted to make sure I had the most current msg.php.t file.

So, was I wrong to directly edit the msg.php.t file from the src folder? I first tried to do it through the template editor in Admin Control panel, but wasn't seein the query (probably for obvious reasons of security).


Thanks and have a great day!

Jon Moss

[Updated on: Mon, 25 April 2005 19:35]

Report message to a moderator

Re: User selectable post order [message #24371 is a reply to message #24366] Mon, 25 April 2005 22:55 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
The source code files cannot be edited via template editor, as the name suggests it is intended for templates ONLY.

Source files should be edited manually, I suspect you simply didn't edit the file correctly resulting in a parser error or a broken SQL query.


FUDforum Core Developer
Re: User selectable post order [message #24527 is a reply to message #24371] Sun, 01 May 2005 16:45 Go to previous messageGo to next message
jonmoss is currently offline  jonmoss   United States
Messages: 93
Registered: September 2004
Location: Lansing, KS
Karma: 0
Member

Ilia wrote on Mon, 25 April 2005 17:55

The source code files cannot be edited via template editor, as the name suggests it is intended for templates ONLY.

Source files should be edited manually, I suspect you simply didn't edit the file correctly resulting in a parser error or a broken SQL query.


I was logged in as root and edited the file changing ASC to DESC in the query. I saved it and rebuilt the theme. When I logged in, nothing was displayed at all when I went to flat view.

Should I not edit as root?

Here's the code/query I was editing:

Quote:

/* This is an optimization intended for topics with many messages */
if ($frm->replies > 250) {
q("CREATE TEMPORARY TABLE {SQL_TABLE_PREFIX}_mtmp_".__request_timestamp__." AS SELECT id FROM {SQL_TABLE_PREFIX}msg
WHERE thread_id=".$_GET['th']." AND apr=1 ORDER BY id ASC LIMIT " . qry_limit($count, $_GET['start']));
}

$result = $query_type('SELECT
m.*,
t.thread_opt, t.root_msg_id, t.last_post_id, t.forum_id,
f.message_threshold,
u.id AS user_id, u.alias AS login, u.avatar_loc, u.email, u.posted_msg_count, u.join_date, u.location,
u.sig, u.custom_status, u.icq, u.jabber, u.affero, u.aim, u.msnm, u.yahoo, u.users_opt, u.last_visit AS time_sec,
l.name AS level_name, l.level_opt, l.img AS level_img,
p.max_votes, p.expiry_date, p.creation_date, p.name AS poll_name, p.total_votes,
'.(_uid ? ' pot.id AS cant_vote ' : ' 1 AS cant_vote ').'
FROM '.($frm->replies > 250 ? '{SQL_TABLE_PREFIX}_mtmp_'.__request_timestamp__.' mt INNER JOIN {SQL_TABLE_PREFIX}msg m ON m.id=mt.id' : ' {SQL_TABLE_PREFIX}msg m').'
INNER JOIN {SQL_TABLE_PREFIX}thread t ON m.thread_id=t.id
INNER JOIN {SQL_TABLE_PREFIX}forum f ON t.forum_id=f.id
LEFT JOIN {SQL_TABLE_PREFIX}users u ON m.poster_id=u.id
LEFT JOIN {SQL_TABLE_PREFIX}level l ON u.level_id=l.id
LEFT JOIN {SQL_TABLE_PREFIX}poll p ON m.poll_id=p.id'.
(_uid ? ' LEFT JOIN {SQL_TABLE_PREFIX}poll_opt_track pot ON pot.poll_id=p.id AND pot.user_id='._uid : ' ').
($frm->replies > 250 ? ' ORDER BY m.id ASC' : " WHERE m.thread_id=".$_GET['th']." AND m.apr=1 ORDER BY m.id ASC LIMIT " . qry_limit($count, $_GET['start'])));



My plan was to change the ASC to DESC in the ORDER BY clause. Have I got the right query?


Thanks and have a great day!

Jon Moss

[Updated on: Sun, 01 May 2005 17:01]

Report message to a moderator

Re: User selectable post order [message #24530 is a reply to message #24527] Sun, 01 May 2005 19:23 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Looks like you are missing a space at the end of the "' ORDER BY m.id ASC' ". If you look at the forum's error logger you should see the failed SQL query that should clarify the problem for you.

FUDforum Core Developer
Re: User selectable post order [message #24540 is a reply to message #24530] Mon, 02 May 2005 14:15 Go to previous messageGo to next message
jonmoss is currently offline  jonmoss   United States
Messages: 93
Registered: September 2004
Location: Lansing, KS
Karma: 0
Member

The space must have been it!

What was also wierd is I couldn't edit the source file msg.php.t with httpd service running. I thought I had done this previously, but perhaps that was also part of the problem as well.

Anyway, I stopped httpd, edited the msg.php.t file, changing all ORDER BY clauses from ASC to DESC, saved the file, restarted httpd service, logged in as admin and rebuilt one of my themes (left the default one alone just in case I had trouble again).

It worked! Smile



Thanks and have a great day!

Jon Moss
Re: User selectable post order [message #24545 is a reply to message #24540] Mon, 02 May 2005 15:19 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Glad to hear it, btw restarting the web server is not necessary, after manually changing the source or template files only the theme rebuild is needed.

FUDforum Core Developer
Re: User selectable post order [message #24546 is a reply to message #24545] Mon, 02 May 2005 15:35 Go to previous messageGo to next message
radiox is currently offline  radiox   Switzerland
Messages: 8
Registered: April 2005
Karma: 0
Junior Member
my users would really like to have the option to reverse the order. so i would be happy if you could include this little piece of code into fudforum.

Smile

Re: User selectable post order [message #24547 is a reply to message #24546] Mon, 02 May 2005 15:40 Go to previous messageGo to next message
jonmoss is currently offline  jonmoss   United States
Messages: 93
Registered: September 2004
Location: Lansing, KS
Karma: 0
Member

It was a very simple code fix/change to the SQL Query in the msg.php.t source file.

As far as offering this as a user preference or setting, that's probably beyond my coding abilities at this point. I wouldn't even know where to start!



Thanks and have a great day!

Jon Moss
Aw: Re: User selectable post order [message #186840 is a reply to message #24547] Sun, 15 March 2015 11:05 Go to previous message
alopezie is currently offline  alopezie   Germany
Messages: 106
Registered: September 2003
Karma: 1
Senior Member
Zitat:
It was a very simple code fix/change to the SQL Query in the msg.php.t source file.
As far as offering this as a user preference or setting, that's probably beyond my coding abilities at this point. I wouldn't even know where to start!


In fact some of our core users are also requiring this feature, but I won´t like to change it for all of them. So did anyone manage to put it as an "option" to be saved in profile ??


Alopezie.de - das Forum zum Thema Haarausfall
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Sending server mails
Next Topic: "Real" last page in long threads
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 23:37:43 GMT 2024

Total time taken to generate the page: 0.02849 seconds