User selectable post order [message #19947] |
Fri, 17 September 2004 19:04 |
hari
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 |
Ilia
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 #24347 is a reply to message #22402] |
Mon, 25 April 2005 12:49 |
jonmoss
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 |
Ilia
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 #24363 is a reply to message #24361] |
Mon, 25 April 2005 18:48 |
jonmoss
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 |
Ilia
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 #24366 is a reply to message #24365] |
Mon, 25 April 2005 19:07 |
jonmoss
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 |
Ilia
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 |
jonmoss
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 |
Ilia
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 #24545 is a reply to message #24540] |
Mon, 02 May 2005 15:19 |
Ilia
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
|
|
|
|
|
Aw: Re: User selectable post order [message #186840 is a reply to message #24547] |
Sun, 15 March 2015 11:05 |
alopezie
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
|
|
|