ElectricBlues wrote: Does anyone know if this mod is compatible with phpbb 2.0.11?
Code: Select all
1. Search for "FIND]" and replace with "FIND ]", Search for "ADD]" and replace with "ADD ]" .....
Code: Select all
2. Search for "&&" and replace with " " (two instances - original code causes display of "&&" in admin and user control panels)
1. This mod calls for editing only language/engish/lang_main.php. However, EasyMod modified lang_main.php in ALL of the Language folders. Is this expected behavior?
2. After applying this mod, the sort order for unregistered guests is still oldest first. I'd like to change this to newest first.
Code: Select all
$sortorder = ( isset($HTTP_POST_VARS['sortorder']) ) ? ( ($HTTP_POST_VARS['sortorder']) ? TRUE : 0 ) : 0;
Will Geocater's post_sort_order_102.mod (allows admin setting of default order) work on top of Warmweer's, or will they clash? If so, is there another way to do it?
Code: Select all
##############################################################
## MOD Title: Post Display Order MOD
## MOD Author: warmweer <undisclosed email> (N/A) testsite removed since it's not up to date
## MOD Description: This MOD will allow your members to choose a general sort order for the posts in viewtopic.
## MOD Version: 1.0.0
##
## Installation Level: Easy
## Installation Time: ±20 minutes
## Files To Edit: 7
## 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-08-30 - Version 1.0.0
## - submitted to MODdb (corrected a FIND and changed version)
## 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 '0';
#
#-----[ 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 . " (user_id, username, user_regdate, user_password, user_email,
#
#-----[ 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'] = 'Sends an e-mail when someone replies to a topic you have posted in. This can be changed whenever you post.';
#
#-----[ 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 ]------------------------------------------
#
//
// 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;
#
#-----[ 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']);
}
}
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
warmweer wrote: Third Warning : The mod was created with phpbb 2.0.5 (so were the mod install instructions). There were a number of changes (small corrections) to the template files as the versions progressed to 2.0.11. The mods still works on 2.0.11 but some finds may not be exactly the same. If I have the time I will check everything next week and if there are changes I will post the new version (for 2.0.11 only) and remove the previous versions (0.0.3 and 1.0.0)
hendriks wrote: I'm still wondering why this mod is not a regular part op phpBB.