Standardmäßig "neuste Beiträge zuerst"

Probleme bei der regulären Arbeiten mit phpBB, Fragen zu Vorgehensweisen oder Funktionsweise sowie sonstige Fragen zu phpBB im Allgemeinen.
Forumsregeln
phpBB 2.0 hat das Ende seiner Lebenszeit überschritten
phpBB 2.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 2.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf phpBB 3.1, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
Antworten
futurebeam
Mitglied
Beiträge: 2
Registriert: 13.07.2005 23:50

Standardmäßig "neuste Beiträge zuerst"

Beitrag von futurebeam »

Hi, wie bekomme ich es hin, dass standardmäßig die "neuesten zuerst" angezeigt werden und nicht die ältesten Beiträge? :-? Am schönsten wäre noch, wenn jeder User das selbst konfigurieren könnte im Profil. Gibt es hierfür eine Lösung?
Mario Siebert
Mitglied
Beiträge: 2295
Registriert: 09.12.2003 15:02
Wohnort: Irgendwo im Nirgendwo

Beitrag von Mario Siebert »

Ich hatte einen solchen Mod noch auf meiner HDD, allerdings ist der schon was älter und ich kann dir nicht garantieren das er im 2.0.16 noch läuft:
########################################################
## Mod Title: user_option_posts_sort
## Mod Version: 1.0.0
## Author: Adam Ismay <admin@boardz.tk>
## Description: Allows users to choose whether they want
## posts displayed newest or oldest first by
## default in thier profile.
##
## Installation Level: fairly easy
## Installation Time: 2-3 Minutes
## Files To Edit: viewtopic.php, profile.php, profile_add_body.tpl
## Included Files: install_sort_mod.php
#########################################################
## Security Disclaimer: This MOD Cannot Be Posted To Or Added At Any Non-Official phpBB Sites
########################################################
## Notes: Pretty easy, this does involve template editting
## and a DB alteration though. A simple install script
## is given for the db update which must be placed in forums
## base directory, run and deleted. Upgrade script
## is designed for mySQL.
##
#################################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
#################################################################

#
#--- [ SQL ] --------
#

ALTER TABLE phpbb_users ADD `user_post_sort` TINYINT(2) DEFAULT '0' not null AFTER `user_popup_pm`;


#
#--- [ OPEN ] --------
#

viewtopic.php

#
#-- [ FIND (line 200) ]----
#

if(!empty($post_id) )
{
$start = floor( ($forum_row['prev_posts'] - 1) / $board_config['posts_per_page']) * $board_config['posts_per_page'];
}

#
#---- [ REPLACE WITH ]-----
#

//
// Decide how to order the post display
//
if ( !empty($HTTP_POST_VARS['postorder']) || !empty($HTTP_GET_VARS['postorder']) )
{
$post_order = (!empty($HTTP_POST_VARS['postorder'])) ? $HTTP_POST_VARS['postorder'] : $HTTP_GET_VARS['postorder'];
$post_time_order = ($post_order == "asc") ? "ASC" : "DESC";
}
else
{
$post_order = ( $userdata['user_post_sort'] == TRUE ) ? 'desc' : 'asc';
$post_time_order = ( $userdata['user_post_sort'] == TRUE ) ? 'DESC' : 'ASC';
}

if(!empty($post_id) )
{
$posts_before = ( $post_order == 'desc' )? (($forum_row['topic_replies'] + 1) - $forum_row['prev_posts']) : ($forum_row['prev_posts'] - 1);
$start = floor( $posts_before / $board_config['posts_per_page']) * $board_config['posts_per_page'];
}


#
#--- [ DELETE (line 358) ] --------
#

//
// Decide how to order the post display
//
if ( !empty($HTTP_POST_VARS['postorder']) || !empty($HTTP_GET_VARS['postorder']) )
{
$post_order = (!empty($HTTP_POST_VARS['postorder'])) ? $HTTP_POST_VARS['postorder'] : $HTTP_GET_VARS['postorder'];
$post_time_order = ($post_order == "asc") ? "ASC" : "DESC";
}
else
{
$post_order = 'asc';
$post_time_order = 'ASC';
}


#
#--- [ OPEN ] --------
#

includes\usercp_register.php

#
#--- [ FIND (line 177) ] --------
#

$user_avatar_type = ( empty($user_avatar_loc) && $mode == "editprofile" ) ? $userdata['user_avatar_type'] : "";

#
#--- [ AFTER, ADD ] --------
#

$user_post_sort = ($HTTP_POST_VARS['user_post_sort'] == 1) ? 1 : 0;

#
#--- [ FIND (line 414) ] --------
#

$sql = "UPDATE " . USERS_TABLE . "
SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) ."', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_sig_bbcode_uid = '$signature_bbcode_uid', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_active = $user_active, user_actkey = '" . str_replace("\'", "''", $user_actkey) . "'" . $avatar_sql . "
WHERE user_id = $user_id";


#
#--- [ REPLACE WITH ] --------
#


$sql = "UPDATE " . USERS_TABLE . "
SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) ."', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_sig_bbcode_uid = '$signature_bbcode_uid', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_active = $user_active, user_actkey = '" . str_replace("\'", "''", $user_actkey) . "'" . $avatar_sql . ", user_post_sort = $user_post_sort
WHERE user_id = $user_id";


#
#--- [ FIND (line 491) ] --------
#

$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey)
VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popuppm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, 0, 1, ";


#
#--- [ REPLACE WITH ] --------
#



$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_post_sort, user_level, user_allow_pm, user_active, user_actkey)
VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popuppm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, $user_post_sort, 0, 1, ";



#
#--- [ FIND (line 887)] --------
#

'L_PROFILE_INFO' => $lang['Profile_info'],
'L_PROFILE_INFO_NOTICE' => $lang['Profile_info_warn'],
'L_EMAIL_ADDRESS' => $lang['Email_address'],

#
#--- [ AFTER, ADD ] --------
#



'L_OLDEST_FIRST' => $lang['Oldest_First'],
'L_NEWEST_FIRST' => $lang['Newest_First'],
'L_POSTS_SORT' => $lang['Posts'] . ' ' . $lang['Sort_by'],
'U_SORT_OLDEST' => $userdata['user_post_sort'] ? '' : 'checked="checked"',
'U_SORT_NEWEST' => $userdata['user_post_sort']? 'checked="checked"' : '',


# This is just an example for subSilver. Don't forget to add to all templates.
#
#--- [ OPEN ] --------
#

profile_add_body.tpl


#
#--- [ FIND (line 187) ] --------
#

<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_POSTS_SORT}:</span></td>
<td class="row2">
<input type="radio" name="user_post_sort" value="0" {U_SORT_OLDEST} />
<span class="gen">{L_OLDEST_FIRST}</span>&nbsp;&nbsp;
<input type="radio" name="user_post_sort" value="1" {U_SORT_NEWEST} />
<span class="gen">{L_NEWEST_FIRST}</span></td>
</tr>


#
#-----[ SAVE ALL FILES ]------------------------------------------
#
# EoM
Grüße Mario
Wer gegen eine geringe Gebühr (höhe der Gebühr bestimmst du selbst!!) ein phpBB installiert oder Mods eingebaut haben möchte sollte sich melden unter: netcom_service@gmx.net - Bisherige Aufträge 68.071
Auf Anfrage führe ich auch Reparaturen/Updates und Serverumzüge durch oder baue Mods!
futurebeam
Mitglied
Beiträge: 2
Registriert: 13.07.2005 23:50

Beitrag von futurebeam »

Hi Mario, ich werde das am Wochenende erstmal auf meiner Testmaschine ausprobieren :-) Schonmal vielen Dank im Vorraus :-)

Malte
Antworten

Zurück zu „phpBB 2.0: Administration, Benutzung und Betrieb“