kimike wrote: The user sees nothing in his profile it's a white paper with nothing on it
Mirlynn wrote: So, if anyone could point me in the general direction of this particular sorting mod, I would GREATLY appreciate it!
Thanks!!!!
Deskdirect wrote: Just would like to know if anyone has this mod working for 2.06?
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>
<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>
<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