MyBB.de Forum

Normale Version: Sortierung der Posts im Brettstrukturmodus umkehren
Du siehst gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
Du willst deinen Usern die Möglichkeit geben, die Sortierung der Posts im Brettstrukturmodus umzukehren ?

1.)

- öffne die Datei /inc/language/deutsch/usercp.lang.php
- füge ganz am Ende der Datei aber vor ?> diese Zeilen ein
PHP-Code:
$l['postsort'] = "Posts sortieren";
$l['postsort_desc'] = "Neuster zuerst";
$l['postsort_asc'] = "Ältester zuerst"
Dies machst du bitte auch mit evtl. anderen Übersetzungen, sonst gibt es Probleme wenn man die Sprache nicht auf Deutsch gestellt hat. Also z.B. /inc/language/english/usercp.lang.php


2.)

- öffne die Datei /usercp.php
- suche um Zeile 669 die Zeile mit dem Inhalt
PHP-Code:
$threadview[$mybb->user['threadmode']] = "selected"
- danach fügst du follgende Zeile ein
PHP-Code:
$postsort[$mybb->user['postsort']] = " selected=\"selected\""
- suche um Zeile 787 die Zeile mit dem Inhalt
PHP-Code:
if($mybb->input['dst'] != "yes"
- nach
PHP-Code:
if($mybb->input['dst'] != "yes")
{
    
$mybb->input['dst'] = "no";

fügst du follgende Zeilen ein
PHP-Code:
if($mybb->input['postsort'] != 2)
{
    
$mybb->input['postsort'] = 1;

- suche um Zeile 850 die Zeile mit dem Inhalt
PHP-Code:
"pmnotify" => $mybb->input['pmnotify'], 
- danach fügst du follgende Zeile ein
PHP-Code:
"postsort" => $mybb->input['postsort'], 


3.)

- öffne die Datei /showthread.php
- suche um Zeile 430 die Zeile mit dem Inhalt
PHP-Code:
$query $db->query("SELECT u.*, u.username AS userusername, p.*, f.*, i.path as iconpath, i.name as iconname, eu.username AS editusername FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid) LEFT JOIN ".TABLE_PREFIX."userfields f ON (f.ufid=u.uid) LEFT JOIN ".TABLE_PREFIX."icons i ON (i.iid=p.icon) LEFT JOIN ".TABLE_PREFIX."users eu ON (eu.uid=p.edituid) WHERE $pids ORDER BY p.dateline"); 
- ersetze diese Zeile durch
PHP-Code:
if($mybb->user["postsort"] == 2) {
    
$order "DESC";
} else {
    
$order "ASC";
}

$query $db->query("SELECT u.*, u.username AS userusername, p.*, f.*, i.path as iconpath, i.name as iconname, eu.username AS editusername FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid) LEFT JOIN ".TABLE_PREFIX."userfields f ON (f.ufid=u.uid) LEFT JOIN ".TABLE_PREFIX."icons i ON (i.iid=p.icon) LEFT JOIN ".TABLE_PREFIX."users eu ON (eu.uid=p.edituid) WHERE $pids ORDER BY p.dateline $order"); 



4.)
- ersetze das Template usercp_options durch (Admin-CP -> Templates -> Ändern / Entfernen: Default Templates ausklappen -> Benutzer Control-Panel Templates ausklappen -> usercp_options anklicken)
Code:
<html>
<head>
<title>$settings[bbname] - $lang->edit_options</title>
$headerinclude
</head>
<body>
$header
<form action="usercp.php" method="post">
<table width="$theme[tablewidth]" border="0" align="center">
<tr>
$usercpnav
<td valign="top">
<table border="0" cellspacing="$theme[borderwidth]" cellpadding="$theme[tablespace]" class="tborder">
<tr>
<td class="thead" colspan="2"><strong>$lang->edit_options</strong></td>
</tr>
<tr>
<td width="50%" class="trow1" valign="top">
<fieldset class="trow2">
<legend><strong>$lang->login_cookies_privacy</strong></legend>
<table cellspacing="0" cellpadding="$theme[tablespace]">
<tr>
<td valign="top" width="1"><input type="checkbox" name="invisible" id="invisible" value="yes" $invisiblecheck /></td>
<td><span class="smalltext"><label for="invisible">$lang->invisible_mode</label></span></td>
</tr>
<tr>
<td valign="top" width="1"><input type="checkbox" name="remember" id="remember" value="yes" $remembercheck /></td>
<td><span class="smalltext"><label for="remember">$lang->remember_me</label></span></td>
</tr>
</table>
</fieldset>
<br />
<fieldset class="trow2">
<legend><strong>$lang->messaging_notification</strong></legend>
<table cellspacing="0" cellpadding="$theme[tablespace]">
<tr>
<td valign="top" width="1"><input type="checkbox" name="allownotices" id="allownotices" value="yes" $allownoticescheck /></td>
<td><span class="smalltext"><label for="allownotices">$lang->allow_notices</label></span></td>
</tr>
<tr>
<td valign="top" width="1"><input type="checkbox" name="hideemail" id="hideemail" value="yes" $hideemailcheck /></td>
<td><span class="smalltext"><label for="hideemail">$lang->allow_emails</label></span></td>
</tr>
<tr>
<td valign="top" width="1"><input type="checkbox" name="emailnotify" id="emailnotify" value="yes" $emailnotifycheck /></td>
<td><span class="smalltext"><label for="emailnotify">$lang->email_notify</label></span></td>
</tr>
<tr>
<td valign="top" width="1"><input type="checkbox" name="receivepms" id="receivepms" value="yes" $receivepmscheck /></td>
<td><span class="smalltext"><label for="receivepms">$lang->receive_pms</label></span></td>
</tr>
<tr>
<td valign="top" width="1"><input type="checkbox" name="pmpopup" id="pmpopup" value="yes" $pmpopupcheck /></td>
<td><span class="smalltext"><label for="pmpopup">$lang->pm_popup</label></span></td>
</tr>
<tr>
<td valign="top" width="1"><input type="checkbox" name="pmnotify" id="pmnotify" value="yes" $pmnotifycheck /></td>
<td><span class="smalltext"><label for="pmnotify">$lang->pm_notify</label></span></td>
</tr>
</table>
</fieldset>
<br />
<fieldset class="trow2">
<legend><strong>$lang->date_time_options</strong></legend>
<table cellspacing="0" cellpadding="$theme[tablespace]">
<tr>
<td><span class="smalltext">$lang->date_format</span></td>
</tr>
<tr>
<td>
<select name="dateformat">
<option value="">$lang->use_default</option>
<option value="1" $dateselect[1]>01-25-2004</option>
<option value="2" $dateselect[2]>01-25-04</option>
<option value="3" $dateselect[3]>01.25.2004</option>
<option value="4" $dateselect[4]>01.25.04</option>
<option value="5" $dateselect[5]>25-01-2004</option>
<option value="6" $dateselect[6]>25-01-04</option>
<option value="7" $dateselect[7]>25.01.2004</option>
<option value="8" $dateselect[8]>25.01.04</option>
<option value="9" $dateselect[9]>January 25th, 2004</option>
<option value="10" $dateselect[10]>Saturday, January 25th, 2004</option>
<option value="11" $dateselect[11]>25th January 1998</option>
<option value="12" $dateselect[12]>Saturday, 25th January 2004</option>
</select>
</td>
</tr>
<tr>
<td><span class="smalltext">$lang->time_format</span></td>
</tr>
<tr>
<td>
<select name="timeformat">
<option value="">$lang->use_default</option>
<option value="1" $timeselect[1]>08:15 pm</option>
<option value="2" $timeselect[2]>08:15 PM</option>
<option value="3" $timeselect[3]>20:15</option>
</select>
</td>
</tr>
<tr>
<td><span class="smalltext">$lang->time_offset</span></td>
</tr>
<tr>
<td >$tzselect</td>
</tr>
</table>
<table cellspacing="0" cellpadding="$theme[tablespace]">
<tr>
<td valign="top" width="1"><input type="checkbox" name="dst" id="dst" value="yes" $dstcheck /></td>
<td><span class="smalltext"><label for="dst">$lang->dst</label></span></td>
</tr>
</table>
</fieldset>
</td>
<td width="50%" class="trow1" valign="top">
<fieldset class="trow2">
<legend><strong>$lang->forum_display_options</strong></legend>
<table cellspacing="0" cellpadding="$theme[tablespace]">
$tppselect
<tr>
<td><span class="smalltext">$lang->thread_view</span></td>
</tr>
<tr>
<td>
<select name="daysprune">
<option value="">$lang->use_default</option>
<option value="1" $daysprunesel[1]>$lang->thread_view_lastday</option>
<option value="5" $daysprunesel[5]>$lang->thread_view_5days</option>
<option value="10" $daysprunesel[10]>$lang->thread_view_10days</option>
<option value="20" $daysprunesel[20]>$lang->thread_view_20days</option>
<option value="50" $daysprunesel[50]>$lang->thread_view_50days</option>
<option value="75" $daysprunesel[75]>$lang->thread_view_75days</option>
<option value="100" $daysprunesel[100]>$lang->thread_view_100days</option>
<option value="365" $daysprunesel[365]>$lang->thread_view_year</option>
<option value="1000" $daysprunesel[1000]>$lang->thread_view_all</option>
</select>
</td>
</tr>
</table>
</fieldset>
<br />
<fieldset class="trow2">
<legend><strong>$lang->thread_view_options</strong></legend>
<table cellspacing="0" cellpadding="$theme[tablespace]">
<tr>
<td valign="top" width="1"><input type="checkbox" name="showsigs" id="showsigs" value="yes" $showsigscheck /></td>
<td><span class="smalltext"><label for="showsigs">$lang->show_sigs</label></span></td>
</tr>
<tr>
<td valign="top" width="1"><input type="checkbox" name="showavatars" id="showavatars" value="yes" $showavatarscheck /></td>
<td><span class="smalltext"><label for="showavatars">$lang->show_avatars</label></span></td>
</tr>
<tr>
<td valign="top" width="1"><input type="checkbox" name="showquickreply" id="showquickreply" value="yes" $showquickreplycheck /></td>
<td><span class="smalltext"><label for="showquickreply">$lang->show_quick_reply</label></span></td>
</tr>
$pppselect
<tr>
<td colspan="2"><span class="smalltext">$lang->thread_mode</span></td>
</tr>
<tr>
<td colspan="2"><select name="threadmode"><option value="">$lang->use_default</option><option value="linear" $threadview[linear]>$lang->linear</option><option value="threaded" $threadview[threaded]>$lang->threaded</option></select></td>
</tr>
<!-- mod start -->
<tr>
<td colspan="2"><span class="smalltext">$lang->postsort</span></td>
</tr>
<tr>
<td colspan="2"><select name="postsort"><option value="1"$postsort[1]>$lang->postsort_asc</option><option value="2"$postsort[2]>$lang->postsort_desc</option></select></td>
</tr>
<!-- mod end -->
</table>
</fieldset>
<br />
<fieldset class="trow2">
<legend><strong>$lang->other_options</strong></legend>
<table cellspacing="0" cellpadding="$theme[tablespace]">
<tr>
<td valign="top" width="1"><input type="checkbox" name="showcodebuttons" id="showcodebuttons" value="1" $showcodebuttonscheck /></td>
<td><span class="smalltext"><label for="showcodebuttons">$lang->show_codebuttons</label></span></td>
</tr>
<tr>
<td colspan="2"><span class="smalltext">$lang->style</span></td>
</tr>
<tr>
<td colspan="2">$stylelist</td>
</tr>
<tr>
<td colspan="2"><span class="smalltext">$lang->board_language</span></td>
</tr>
<tr>
<td colspan="2"><select name="language"><option value="">$lang->use_default</option><option value="0">-----------</option>$langoptions</select></td>
</tr>
</table>
</fieldset>
</td>
</tr>
</table>
<br />
<div align="center">
<input type="hidden" name="action" value="do_options">
<input type="submit" class="submit" name="regsubmit" value="$lang->update_options">
</div>
</td>
</tr>
</table>
</form>
$footer
</body>
</html>


5.)
- führe folgenden SQL Befehl aus, z.b. über phpMyAdmin
Code:
ALTER TABLE `mybb_users` ADD `postsort` INT( 1 ) NOT NULL DEFAULT '1';

Ich hoffe es funktioniert Smile
ich hätte da mal eine frage:

gibt es eine derartige anleitung auch für die aktuellste version des boards?
mit den hier angegebenen veränderungen komme ich in der version 1.4.4 nicht weiter...