[RC] Post Display Order

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
kimike
Registered User
Posts: 2
Joined: Wed Aug 27, 2003 3:31 pm

Post by kimike »

After I have done this mod! And all the changes from Rob. The profile isn't showing anything anymore.

Somebody help!!
User avatar
warmweer
Jr. Extension Validator
Posts: 11200
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium
Contact:

Post by warmweer »

kimike? What do you mean, in profile_add_body.tpl or in user_edit.tpl?

There are no changes at all in viewprofile!!

If you're missing the radiobuttons, then you've probably missed out on the changes in the tpl-files.

Perhaps the easiest way to solve this is to reinstall (or compare your files with the new version I posted earlier today)
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
Mirlynn
Registered User
Posts: 24
Joined: Tue May 13, 2003 5:42 am

admin topic default sort mod - what/where is it?

Post by Mirlynn »

Imagedude included a post for a mod geared toward forum admins that allows one to define the default sort order of topics. What is the name of this mod? I would love to put it in so the entire forum is consistent. I do not wish to give my users the capability of individually sorting.

So, if anyone could point me in the general direction of this particular sorting mod, I would GREATLY appreciate it!

Thanks!!!!
kimike
Registered User
Posts: 2
Joined: Wed Aug 27, 2003 3:31 pm

Post by kimike »

I mean. The user sees nothing in his profile it's a white paper with nothing on it. For sure I did the new version of the mod manually. And still the user can't see any options in his profile of the forum.

I found out that when I replace the original usercp_register the user is seeing the profile but then they still can't make a choice of the postorder.

Please Help, I like this feature on my board!

If you want I can speak to you in dutch. It's easier for me and maybe for you too??

PS. Thanks to you : the sortorder is now "newest first" (that thing of the mod is wordking) that's better then oldest first but I still want that the user can make his own choice.
User avatar
warmweer
Jr. Extension Validator
Posts: 11200
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium
Contact:

Post by warmweer »

kimike wrote: The user sees nothing in his profile it's a white paper with nothing on it

Again, nothing has changed in the profile, so if that is a white page, there must be an error somewhere else. Unless I've misunderstood and by profile you mean the user preferences. (BTW in Dutch profiel and instellingen leave no room for misunderstanding 8)

It's still not quite clear to me. If the user sees the radiobuttons in the registration form but any changes made are not saved, then the error is in the SQL insert statement (probably the order of the fields and the inserted values).

If the user cannot edit his profile (after registration), the error will be in the SQL update.

Try and post the SQL statements here so that I can have a look at the order.

Also check if the admin can edit the user's settings.

If no radiobuttons are visible then something is wrong with the tpl files.

I prefer not to post in dutch or french here as this is an anglophonic board, however you can PM me in dutch if necessary (or french, spanish, portuguese for others.) I would prefer questions here though so as not to have to repeat certain things, also if there are mistakes, the members here can also help in solving them.
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
User avatar
warmweer
Jr. Extension Validator
Posts: 11200
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium
Contact:

Re: admin topic default sort mod - what/where is it?

Post by warmweer »

Mirlynn wrote: So, if anyone could point me in the general direction of this particular sorting mod, I would GREATLY appreciate it!
Thanks!!!!


Edit 30/08/03: Oops , just read Mirlynn's post again and the request was for topic ordering, not post ordering. Sorry for the wrong answer :oops:

I haven't found it but if I remember correctly the only change involved was

In viewtopic.php find
$post_order = 'asc';
$post_time_order = 'ASC';
and replace asc by desc and ASC by DESC.

However, if you use descending order, links to posts will get messed up as will the latest_post link (in viewforum and viewtopic). You could avoid this problem by also including the part in my mod where $start is redefined.
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
User avatar
warmweer
Jr. Extension Validator
Posts: 11200
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium
Contact:

Post by warmweer »

Oops,
While messing around with some other mod in development I realised that
a FIND instruction in the code for admin/admin_users.php was still pointing to the complete SET statement. The instructions could therefore cause some problems in the case of modded boards. The FIND instruction has now been shortened (no changes to the MOD itself).

I guess it's time to try and submit this (edit: which I've just done - Topic Title hasn't been changed - since [SUBMITTED] isn't allowed).
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
User avatar
warmweer
Jr. Extension Validator
Posts: 11200
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium
Contact:

Post by warmweer »

And I just read somwhere that I should mention the phpbb version the mod is for.

2.0.6 but it also works on 2.0.4 and 2.0.5 however the install instructions are written for 2.0.6 so the find for popup_pm will not always work (popuppm changed to popup_pm). Nothing which should cause any difficulty but better to be warned.

Also read something about not all SQL statements being accpeted by all databases. Thus: this was made for MySQL (no guarantees are given anywhere else since I haven't tested it anywhere else)

PS changed topic title to [RC]
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
g-funk
Registered User
Posts: 34
Joined: Tue Sep 09, 2003 5:58 pm

Post by g-funk »

Hi warmweer

Since I like this mod so much i've taken your 0.0.2 verion and modified it so that it installs with easymod. And ive added another mod so that it adds a fiels to the Profile Control Pannel.

I can't post it as code since it would remove the TABS that Easymod needs. and I dont have any rights to post attachments. So do you want me to email it to you ?

CYa
G-Funk
User avatar
warmweer
Jr. Extension Validator
Posts: 11200
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium
Contact:

Post by warmweer »

g-funk

Sure you can mail it, I'll PM you. I'ld certainly like to see the differences (to make it easymod compatible).

kimike

anything new since my PM's (5 september - you didn't read them)
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
Deskdirect
Registered User
Posts: 60
Joined: Sun Dec 01, 2002 3:03 pm

Post by Deskdirect »

Just would like to know if anyone has this mod working for 2.06?
User avatar
warmweer
Jr. Extension Validator
Posts: 11200
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium
Contact:

Post by warmweer »

Deskdirect wrote: Just would like to know if anyone has this mod working for 2.06?


It's been on 2.0.5 and on 2.0.6
The mod was submitted tot de mods DB but refused because I cannot support it (no email disclosed). I have no idea whether it was checked for errors.

Just in case I'll repost all of the code again and remove the code from previous post so as to avoid confusion.

There was a version 1.0.0 (submitted) with some small changes by me (e.g. default sort order newest first) but as far as I remember version 0.0.3 worked perfectly.

Code: Select all

############################################################## 
## MOD Title: Post Display Order MOD 
## MOD Author: warmweer <undisclosed email> (N/A) http://members.lycos.nl/warmweer2/VPforum/index.php 
## MOD Description: This MOD will allow your members to choose a general sort order for the posts in viewtopic. 
## MOD Version: 0.0.3 
## 
## Installation Level: Easy 
## Installation Time: ±20 minutes 
## Files To Edit: 
##   viewtopic.php 
##   includes/usercp_register.php 
##   includes/usercp_avatar.php 
##   admin/admin_users.php 
##   language/lang_english/lang_main.php 
##   templates/subSilver/profile_add_body.tpl 
##   templates/subSilver/admin/user_edit_body.tpl 
## 
## Included Files: n/a 
## 
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/ 
############################################################## 
## Author Notes: 
## This mod adds an extra setting with which the user can specify the general post display ordering in viewtopic. Default sortorder when registering is Descending (Newest_first). This can be changed in usercp_register (look at the POST_VAR sortorder) 
## User and admin can change the selected display order. 
## 
############################################################## 
## MOD History: 
## 
##   2003-09-18 - Version 0.0.3
##   - Made made to work with easymod 0.0.10a by [email protected]
##   - Made a extra Profile Control Panel add-on mod to add the selection field, by [email protected]
##   2003-08-27 - Version 0.0.2 
##   - Corrected a few mistakes and left-outs in the install instructions 
##   2003-08-09 - Version 0.0.1 
##   - Initial code release 
##  
############################################################## 
## MOD Localisation: 
## 
## N/A 
## 
################################################################# 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
################################################################# 
# 
#-----[ SQL ]------------------------------------------ 
# If you do not know how to do the below SQL dump from command line, than you will need to 
# download, install & use an SQL Interface, such as: 
# MySQL: phpMyAdmin ( http://www.phpmyadmin.net/ ) 
# PostgreSQL: PostgreSQL Manager ( http://ems-hitech.com/pgmanager/ ) 
# 
ALTER TABLE phpbb_users ADD user_sortorder TINYINT null DEFAULT '1'; 
# 
#-----[ OPEN ]------------------------------------------ 
# 
includes/usercp_register.php 
# 
#-----[ FIND ]------------------------------------------ 
# 
$popup_pm = ( isset($HTTP_POST_VARS['popup_pm']) ) ? ( ($HTTP_POST_VARS['popup_pm']) ? TRUE : 0 ) : TRUE; 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
$sortorder = ( isset($HTTP_POST_VARS['sortorder']) ) ? ( ($HTTP_POST_VARS['sortorder']) ? TRUE : 0 ) : 0; 
# 
#-----[ FIND ]------------------------------------------ 
# 
			$sql = "UPDATE " . USERS_TABLE . " 
				SET " . $username_sql . $passwd_sql 
# 
#-----[ IN-LINE FIND ]------------------------------------- 
# 
user_style = $user_style, 
# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 
user_sortorder = $sortorder, 
# 
#-----[ FIND ]------------------------------------------ 
# 
			$sql = "INSERT INTO " . USERS_TABLE .
# 
#-----[ IN-LINE FIND ]------------------------------------- 
# 
user_style, 
# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 
user_sortorder, 
# 
#-----[ FIND ]------------------------------------- 
# 
	VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_password) . "', '" . str_replace("\'", "''", $email) . "', 
# 
#-----[ IN-LINE FIND ]------------------------------------- 
# 
$user_style, 
# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 
$sortorder, 
# 
#-----[ FIND ]------------------------------------------ 
# 
	$allowviewonline = $userdata['user_allow_viewonline']; 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
	$sortorder = $userdata['user_sortorder']; 
# 
#-----[ FIND ]------------------------------------- 
# 
	display_avatar_gallery($mode, $avatar_category, $user_id, $email, $current_email, $coppa, $username, $email, 
# 
#-----[ IN-LINE FIND ]------------------------------------- 
# 
$user_style, 
# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 
$sortorder, 
# 
#-----[ FIND ]------------------------------------------ 
# 
	'NOTIFY_PM_NO' => ( !$notifypm ) ? 'checked="checked"' : '', 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
	'SORTORDER_ASC' => ( $sortorder ) ? 'checked="checked"' : '', 
	'SORTORDER_DESC' => ( !$sortorder ) ? 'checked="checked"' : '', 
# 
#-----[ FIND ]------------------------------------------ 
# 
	'L_ALWAYS_ADD_SIGNATURE' => $lang['Always_add_sig'], 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
	'L_SORT_ASCENDING' => $lang['Oldest_First'], 
	'L_SORT_DESCENDING' => $lang['Newest_First'], 
# 
#-----[ FIND ]------------------------------------------ 
# 
	'L_NOTIFY_ON_PRIVMSG' => $lang['Notify_on_privmsg'], 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
	'L_MESSAGE_ORDER' => $lang['Select_message_order'], 
# 
#-----[ OPEN ]------------------------------------- 
# 
includes/usercp_avatar.php 
# 
#-----[ FIND ]------------------------------------- 
# 
	function display_avatar_gallery($mode, &$category, &$user_id, &$email, &$current_email, &$coppa, &$username, &$email, 
# 
#-----[ IN-LINE FIND ]------------------------------------- 
# 
&$style, 
# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------- 
# 
&$sortorder, 
# 
#-----[ FIND ]------------------------------------- 
# 
	$params = array('coppa', 'user_id', 'username', 'email', 'current_email', 'cur_password', 'new_password', 
# 
#-----[ IN-LINE FIND]------------------------------------- 
# 
'style', 
# 
#-----[ IN-LINE AFTER, ADD]------------------------------------- 
# 
'sortorder', 
# 
#-----[ OPEN ]------------------------------------------ 
# 
language/lang_english/lang_main.php 
# 
#-----[ FIND ]------------------------------------------ 
# 
	$lang['Always_notify_explain'] =  
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
	$lang['Select_message_order'] = 'Select the order in which posts will be shown'; 
# 
#-----[ OPEN ]------------------------------------------ 
# 
admin/admin_users.php 
# 
#-----[ FIND ]------------------------------------------ 
# 
	$popuppm = ( isset( $HTTP_POST_VARS['popup_pm']) ) ? ( ( $HTTP_POST_VARS['popup_pm'] ) ? TRUE : 0 ) : TRUE; 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
	$sortorder = ( isset($HTTP_POST_VARS['sortorder']) ) ? ( ($HTTP_POST_VARS['sortorder']) ? TRUE : 0 ) : 0; 
# 
#-----[ FIND ]------------------------------------------ 
# 
	SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) . "', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', 
# 
#-----[ IN-LINE FIND ]------------------------------------- 
# 
user_style = $user_style, 
# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 
user_sortorder = $sortorder, 
# 
#-----[ FIND ]------------------------------------------ 
# 
	$notifypm = $this_userdata['user_notify_pm']; 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
	$sortorder = $this_userdata['user_sortorder']; 
# 
#-----[ FIND ]------------------------------------------ 
# 
	$s_hidden_fields .= '<input type="hidden" name="notifypm" value="' . $notifypm . '" />'; 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
	$s_hidden_fields .= '<input type="hidden" name="sortorder" value="' . $sortorder . '" />'; 
# 
#-----[ FIND ]------------------------------------------ 
# 
	'NOTIFY_PM_NO' => (!$notifypm) ? 'checked="checked"' : '', 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
	'SORTORDER_ASC' => ( $sortorder ) ? 'checked="checked"' : '', 
	'SORTORDER_DESC' => ( !$sortorder ) ? 'checked="checked"' : '', 
# 
#-----[ FIND ]------------------------------------------ 
# 
	'L_ALWAYS_ADD_SIGNATURE' => $lang['Always_add_sig'], 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
	'L_SORT_ASCENDING' => $lang['Oldest_First'], 
	'L_SORT_DESCENDING' => $lang['Newest_First'], 
# 
#-----[ FIND ]------------------------------------------ 
# 
		'L_NOTIFY_ON_PRIVMSG' => $lang['Notify_on_privmsg'], 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
		'L_MESSAGE_ORDER' => $lang['Select_message_order'], 
# 
#-----[ OPEN ]------------------------------------------ 
# 
templates/subSilver/profile_add_body.tpl 
# 
#-----[ FIND ]------------------------------------------ 
# 
	<tr> 
	  <td class="row1"><span class="gen">{L_ALWAYS_ALLOW_SMILIES}:</span></td> 
	  <td class="row2"> 
		<input type="radio" name="allowsmilies" value="1" {ALWAYS_ALLOW_SMILIES_YES} /> 
		<span class="gen">{L_YES}</span>&nbsp;&nbsp;
		<input type="radio" name="allowsmilies" value="0" {ALWAYS_ALLOW_SMILIES_NO} /> 
		<span class="gen">{L_NO}</span></td> 
	</tr> 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
	<tr> 
	  <td class="row1"><span class="gen">{L_MESSAGE_ORDER}:</span></td> 
	  <td class="row2"> 
	   <input type="radio" name="sortorder" value="1" {SORTORDER_ASC} /> 
	   <span class="gen">{L_SORT_ASCENDING}</span>&& 
	   <input type="radio" name="sortorder" value="0" {SORTORDER_DESC} /> 
	   <span class="gen">{L_SORT_DESCENDING}</span></td> 
	</tr> 
# 
#-----[ OPEN ]------------------------------------------ 
# 
templates/subSilver/admin/user_edit_body.tpl 
# 
#-----[ FIND ]------------------------------------------ 
# 
	<tr> 
	  <td class="row1"><span class="gen">{L_ALWAYS_ALLOW_SMILIES}</span></td>
	  <td class="row2">
		<input type="radio" name="allowsmilies" value="1" {ALWAYS_ALLOW_SMILIES_YES} />
		<span class="gen">{L_YES}</span>&nbsp;&nbsp;
		<input type="radio" name="allowsmilies" value="0" {ALWAYS_ALLOW_SMILIES_NO} />
		<span class="gen">{L_NO}</span></td>
	</tr>
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
	<tr> 
	  <td class="row1"><span class="gen">{L_MESSAGE_ORDER}:</span></td> 
	  <td class="row2"> 
		<input type="radio" name="sortorder" value="1" {SORTORDER_ASC} /> 
		<span class="gen">{L_SORT_ASCENDING}</span>&& 
		<input type="radio" name="sortorder" value="0" {SORTORDER_DESC} /> 
		<span class="gen">{L_SORT_DESCENDING}</span></td> 
	</tr> 
# 
#-----[ OPEN ]------------------------------------------ 
# 
viewtopic.php 
# 
#-----[ FIND ]----------------------------------------------- 
#  
if ( !empty($post_id) )
{
	$start = floor(($forum_topic_data['prev_posts'] - 1) / intval($board_config['posts_per_page'])) * intval($board_config['posts_per_page']);
}
# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
	if ( !empty($post_id) ) 
	{ 
		if ($userdata['user_sortorder'] == 0) 
		{ 
			$sql = "SELECT COUNT(post_id) AS total_posts FROM  " . POSTS_TABLE . " WHERE forum_id = " . $forum_id . " AND topic_id = " . $topic_id; 
			if ( !($result = $db->sql_query($sql)) ) 
			{ 
				message_die(GENERAL_ERROR, "Could not obtain number of posts in topic", '', __LINE__, __FILE__, $sql); 
			} 
			$total_posts = ( $row = $db->sql_fetchrow($result) ) ? intval($row['total_posts']) : 0; 
			$start = floor(($total_posts - $forum_topic_data['prev_posts'] )/ intval($board_config['posts_per_page'])) * intval($board_config['posts_per_page']); 
		} 
		else 
		{ 
			$start = floor(($forum_topic_data['prev_posts'] - 1) / intval($board_config['posts_per_page'])) * intval($board_config['posts_per_page']); 
		} 
	} 
#
#-----[ FIND ]------------------------------------------
#
//
// Decide how to order the post display
//
#
#-----[ AFTER, ADD ]------------------------------------------
#
        if ($userdata['user_sortorder'] == 0)
        {
                $user_post_order = 'desc';
        $user_post_time_order = 'DESC';
        }
        else
        {
                $user_post_order ='asc';
                $user_post_time_order = 'ASC';
        }
#
#-----[ FIND ]------------------------------------------
#
        $post_order = 'asc';
        $post_time_order = 'ASC';
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
        $post_order = $user_post_order;
        $post_time_order = $user_post_time_order;
# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM 
As of now the mod it up for grabs. I offered it to G-Funk but got no reply. Pity because he also made an add-on for it (and made it EM compatible).

So have fun with it. BTW intially many users try the mod, after a week they revert back to the Oldest Posts first order, but after a couple of months I notice that approx. 30% of the users stick to Newest posts first (which is the default order on my board)
User avatar
warmweer
Jr. Extension Validator
Posts: 11200
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium
Contact:

Post by warmweer »

There has been a security fix mentioned in the announcements
http://www.phpbb.com/phpBB/viewtopic.ph ... 006#989006.
Users having applied my post display mod can easily apply the fix (replace one line).
For users having installed 2.0.6 d the above code is still valid (no changes to the code).
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
Ouwejan
Registered User
Posts: 5
Joined: Tue Jun 03, 2003 1:07 pm

Post by Ouwejan »

Thanks HotWeather!!! Been searching for a method like this a long, long time (including hours of editing).
User avatar
warmweer
Jr. Extension Validator
Posts: 11200
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium
Contact:

Post by warmweer »

A slight bump just to mention that this mod worked over 2.07a, b, c and d and still works on 2.0.8a.
The mod is still up for grabs - nobody interested??
and BTW I haven't had time to upgrade my demo forum (no remarks please)
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
Locked

Return to “[2.0.x] MODs in Development”