[2.0.6] Topic display order

The cleanup is complete. This forum is now read only.

Rating:

Excellent!
12
50%
Very Good
5
21%
Good
4
17%
Fair
2
8%
Poor
1
4%
 
Total votes: 24

User avatar
richard@callidesign.com
Registered User
Posts: 6
Joined: Thu Mar 18, 2004 3:38 am
Location: Portland, OR USA
Contact:

Post by richard@callidesign.com » Tue Jun 01, 2004 4:43 pm

Thanks for the quick response. Actually, here is the SQL statement as I have it after doing the mod:
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time
FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2
WHERE t.forum_id = $forum_id
AND t.topic_poster = u.user_id
AND p.post_id = t.topic_first_post_id
AND p2.post_id = t.topic_last_post_id
AND u2.user_id = p2.poster_id
AND t.topic_type <> " . POST_ANNOUNCE . "
$limit_topics_time
ORDER BY t.topic_type DESC, $sort_method $order_method, t.topic_last_post_id DESC
LIMIT $start, ".$board_config['topics_per_page'];


It appears that the $sort_method and $order_method variables are not "parsing" anything and thus showing up blank ... that's why it appears like I have just 2 commas next to each other in the error message.

Any thoughts as to why this is happening? I went over the mod instructions several times and cannot find where I went wrong.

Thanks in advance,
Richard

User avatar
warmweer
Registered User
Posts: 2320
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Belt ... well actually Belgium

Post by warmweer » Tue Jun 01, 2004 5:27 pm

richard@callidesign.com wrote:

Code: Select all

ORDER BY t.topic_type DESC, $sort_method $order_method, t.topic_last_post_id DESC 


You probably forgot a comma between $sort_method and $order_method.
My board's not broken, it just went peculiar

User avatar
richard@callidesign.com
Registered User
Posts: 6
Joined: Thu Mar 18, 2004 3:38 am
Location: Portland, OR USA
Contact:

Post by richard@callidesign.com » Tue Jun 01, 2004 5:34 pm

You probably forgot a comma between $sort_method and $order_method.


Actually, I thought of that too and even though the Mod instructions do not say to put on in between them I did and then received the same original error message (as above) but this time it showed three (3) commas ....

Other ideas?
Cheers,
Richard

User avatar
warmweer
Registered User
Posts: 2320
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Belt ... well actually Belgium

Post by warmweer » Tue Jun 01, 2004 5:50 pm

richard@callidesign.com wrote: Actually, I thought of that too and even though the Mod instructions do not say to put on in between them I did and then received the same original error message (as above) but this time it showed three (3) commas ....

OK, I just checked the modinstall instructions and effectively it doesn't mention any comma there, and looking at the logic (which I should have done before my previous post, sorry about that :oops: ) There shouldn't be any comma.
Since the value is non-existant, I think it means that these variables are not declared before you use them (or that they are not set by a HTTP_GET_VARS or a form action).

Check in your viewforum where these variables are declared/set and post those lines. In the meantime I'll check my archive (I've got this mod installed somewhere - slightly adapted though).

edit: found my files and those variables are declared just before the SQL section (as per instructions). Just check (again, I know :( ) that you've added everything as per modinstall. If you still have errors, PM me and I'll PM you my viewforum (too much code for the forum here)
My board's not broken, it just went peculiar

User avatar
richard@callidesign.com
Registered User
Posts: 6
Joined: Thu Mar 18, 2004 3:38 am
Location: Portland, OR USA
Contact:

Post by richard@callidesign.com » Tue Jun 01, 2004 6:00 pm

warmweer wrote:
Check in your viewforum where these variables are declared/set and post those lines.


Okay, here's what appears just prior to that SQL statement:
// default forum values
$dft_sort = $forum_row['forum_display_sort'];
$dft_order = $forum_row['forum_display_order'];

// Sort def
$sort_value = $dft_sort;
if ( isset($HTTP_GET_VARS['sort']) || isset($HTTP_POST_VARS['sort']) )
{
$sort_value = isset($HTTP_GET_VARS['sort']) ? intval($HTTP_GET_VARS['sort']) : intval($HTTP_POST_VARS['sort']);
}
$sort_list = '<select name="sort">' . get_forum_display_sort_option($sort_value, 'list', 'sort') . '</select>';

// Order def
$order_value = $dft_order;
if ( isset($HTTP_GET_VARS['order']) || isset($HTTP_POST_VARS['order']) )
{
$order_value = isset($HTTP_GET_VARS['order']) ? intval($HTTP_GET_VARS['order']) : intval($HTTP_POST_VARS['order']);
}
$order_list = '<select name="order">' . get_forum_display_sort_option($order_value, 'list', 'order') . '</select>';

// display
$s_display_order = '&nbsp;' . $lang['Sort_by'] . ':&nbsp;' . $sort_list . $order_list . '&nbsp;';

// selected method
$sort_method = get_forum_display_sort_option($sort_value, 'field', 'sort');
$order_method = get_forum_display_sort_option($order_value, 'field', 'order');


Hope this helps! I am at a loss. :cry:
Cheers,
Richard

User avatar
warmweer
Registered User
Posts: 2320
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Belt ... well actually Belgium

Post by warmweer » Tue Jun 01, 2004 6:19 pm

OK, this is a hard one :) I can't see anything wrong in the coding above (but that's no guarantee)
I take it that you've modified functions.php (since there's no error mesage when calling the new functions).
What about the SQL with database changes? Did you alter the _forums-table as required?

BTW which version of phpBB?

edit: in case you did alter the tabel, try stopping the viewforum.php by inserting a piece of code which will output the values of the variables you want to check: something like this for example

Code: Select all

		message_die(GENERAL_ERROR, 'Stopped execution to output the variable', '', __LINE__, __FILE__, insert variable here);
.
Insert it wherever you need it but make sure you only activate one debug at a time.
That might help finding which variables cause the problem.
Last edited by warmweer on Tue Jun 01, 2004 6:27 pm, edited 1 time in total.
My board's not broken, it just went peculiar

User avatar
richard@callidesign.com
Registered User
Posts: 6
Joined: Thu Mar 18, 2004 3:38 am
Location: Portland, OR USA
Contact:

Post by richard@callidesign.com » Tue Jun 01, 2004 6:27 pm

Yep, added the two new fields to the required table .... this one is a stumper.

I even started over three times, to only receive a similar error each time.
Cheers,
Richard

User avatar
warmweer
Registered User
Posts: 2320
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Belt ... well actually Belgium

Post by warmweer » Thu Jun 03, 2004 6:36 pm

richard@callidesign.com wrote: Yep, added the two new fields to the required table .... this one is a stumper.

I even started over three times, to only receive a similar error each time.

I don't think it's fair to end this here. Over our PM conversation following these posts, Richard discovered that he had applied the SQL (2 new fields for this mod) but ... to the wrong database.

Conclusion: there was no error in the mod (or in the instructions) and it's works exactly as described.

and BTW, it works on my board also (with 2.0.8a)
My board's not broken, it just went peculiar

sssphpbb
Registered User
Posts: 127
Joined: Wed Jun 16, 2004 7:37 pm

Where is Admin CP setting?

Post by sssphpbb » Thu Jul 01, 2004 12:14 am

I just installed this MOD and everything seems to work fine except I can't find the place in Admin CP to set the default sort order?

Am I missing it, or is there no way to set the default?

sssphpbb
Registered User
Posts: 127
Joined: Wed Jun 16, 2004 7:37 pm

Found it

Post by sssphpbb » Thu Jul 01, 2004 2:53 pm

I was looking for it on the main forum admin page; thought you could only have one default setting for the whole board. Didn't know you can set each Forum -- COOL!

However, in re-checking my admin_forums.php MOD edits, I found a glitch: when you copy in the MOD, which ends with:

Code: Select all

//END MOD... ---------------- 
, because there's no line break after the --------------- the following line (from the original file) got tacked on to the MOD note. (Since the --------- line is so long, you don't see the error unless you scroll over.)

For the next release, you may want to put that line break after all the -------- lines.

sssphpbb
Registered User
Posts: 127
Joined: Wed Jun 16, 2004 7:37 pm

1064 Error

Post by sssphpbb » Thu Jul 01, 2004 4:23 pm

OK, I spoke too soon; I'm getting the same 1064 error two others have posted. I checked my DB per Warmweer's post:
Richard discovered that he had applied the SQL (2 new fields for this mod) but ... to the wrong database.

Mine looks OK.

Here's my code in admin_forums.php:

Code: Select all

				SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", forum_display_order = " . intval($HTTP_POST_VARS['forum_display_order']) . ", forum_display_sort = " . intval($HTTP_POST_VARS['forum_display_sort']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . "
Any clues?

sssphpbb
Registered User
Posts: 127
Joined: Wed Jun 16, 2004 7:37 pm

1064 error

Post by sssphpbb » Thu Jul 01, 2004 6:51 pm

Re my still unsolved 1064 error, are there any known conflicts between this MOD and Favorites or Xtreme Styles?

I've put my original admin_forums.php back in and everything's fine (accept no admin CP default setting of course).

While I'm waiting for help on the bug fix, can't anyone give me a quik-fix on how to manually set the default sort for all Forums to: Topic Title/Ascending

Whether via file edit or MySql command that I can enter directly via server.

Thanx.

sssphpbb
Registered User
Posts: 127
Joined: Wed Jun 16, 2004 7:37 pm

1064 again

Post by sssphpbb » Thu Jul 01, 2004 7:00 pm

Maybe someone can just email a working admin_forums.php file (phpbb v. 2.0.8, with no other MODS).

PM me.

jasonsamuel
Registered User
Posts: 3
Joined: Thu Jul 22, 2004 4:36 pm

Post by jasonsamuel » Thu Jul 22, 2004 5:44 pm

Thanks... but uh...

I'm a total coding scrub. I own a website and just clicked for the server to add phpBB for me. Then I logged in with my admin password and figured out how the admin panel worked. But when it comes to coding, I'm clueless. I have ZERO idea how to install this or even if I can get at the code on my webpage to begin the installation process.

Got a link for a tutorial? Or a REALLY dumbed down explanation for installing these things? thanks a ton...

Joe Belmaati
Registered User
Posts: 2110
Joined: Sun Sep 28, 2003 7:35 pm
Location: Denmark

Post by Joe Belmaati » Sat Jul 24, 2004 2:18 pm

This MOD contains some code at the end of viewtopic.php

Code: Select all

		'PAGINATION' => generate_pagination("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&topicdays=$topic_days&sort=$sort_value&order=$order_value", $topics_count, $board_config['topics_per_page'], $start),
instead of

Code: Select all

		'PAGINATION' => generate_pagination("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&topicdays=$topic_days", $topics_count, $board_config['topics_per_page'], $start),
This causes pagination to stop working for guests when you've got mod_rewrite installed.

I switched back to the original lines for that part of the code in viewtopic.php and interestingliy, the topic sort order still works, unless someone clicks "page 2" for instance, in which case the topic display sort order reverts to default.

Maybe one of the php-programmers can show me a work-around...?

Many thank you's in advance,
Joe Belmaati
Copenhagen Denmark

Post Reply

Return to “[2.0.x] MOD Database Cleanup”