Buna
Ce trebuie sa modific in codul php, ca raspunsurile sa se aranjeze dupa data cand au fost postate?
Adica sa se afiseze totdeauna ultimul raspuns, nu prima?
Mersi
Aranjarea raspunsurilor - Topic Display Order
- bogdan
- Mesaje: 10888
- Membru din: 18-Oct-2002, 13:14:27
- Versiune: 3.0.11
- Ext: Da
- Server: UNIX/Linux
- Nivel phpBB: Experimentat
- Nivel php: Mediu
- Localitate: Bucuresti
- Contact:
pentru ca userii sa-si aleaga modul de afisare al raspunsurilor poti sa folosesti unul din MOD-urile de mai jos
Topic Display Order v 1.0.2
- Creat de Ptirhiik < admin@rpgnet-fr.com>
- Testat pe versiunea phpBB 2.0.6
- Permite ordonare dupa titlu, autor, data
- Download: rpgnet.clanmckeen.com sau phpHacks
- Demo: http://rpgnet.clanmckeen.com/demo/viewtopic.php?t=514
User Option Posts Sort creat de Adam Ismay <admin@boardz.tk>
- Testat pe versiunea phpBB 2.0.2
- Permite ordonare dupa data
- Demo: http://www.aismay.f2s.com/phpBB/viewtopic.php?t=23

- Creat de Ptirhiik < admin@rpgnet-fr.com>
- Testat pe versiunea phpBB 2.0.6
- Permite ordonare dupa titlu, autor, data
- Download: rpgnet.clanmckeen.com sau phpHacks
- Demo: http://rpgnet.clanmckeen.com/demo/viewtopic.php?t=514

- Testat pe versiunea phpBB 2.0.2
- Permite ordonare dupa data
- Demo: http://www.aismay.f2s.com/phpBB/viewtopic.php?t=23
Cod: Selectaţi tot
########################################################
## 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
#################################################################
#
#--- [ 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>&&
<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>&&
<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
Dupa ce am facut modificarile, acest error am primit, cand am testat. Deci, am vrut sa schimb din profil, ca topicurile sa fie ordonate dupa data.Could not update users table
DEBUG MODE
SQL Error : 1064 You have an error in your SQL syntax near ' user_timezone = 2, user_dateformat = 'd M Y h:i a', user_lang = 'hungarian', us' at line 2
UPDATE phpbb_users SET user_email = 'mn@mn.mn', user_icq = '', user_website = '', user_occ = 'Zenész', user_from = '', user_interests = '', user_sig = '', user_sig_bbcode_uid = '7d0983839e', user_viewemail = 1, user_aim = '', user_yim = '', user_msnm = '', user_attachsig = 1, user_allowsmile = 1, user_allowhtml = 0, user_allowbbcode = 1, user_allow_viewonline = 1, user_notify = 1, user_notify_pm = 1, user_popup_pm = , user_timezone = 2, user_dateformat = 'd M Y h:i a', user_lang = '', user_style = 1, user_active = 1, user_actkey = '', user_post_sort = 0 WHERE user_id = 2
Line : 459
File : c:\program files\apache group\apache\htdocs\phpbb2\includes\usercp_register.php
Dar am observat, ca "user_post_sort " nu gasesc in baza de date? Oare asta ar putea fii problema?
Cum pot rezolva aceasta problema?
Am folosit
User Option Posts Sort creat de Adam Ismay <admin@boardz.tk>
- Testat pe versiunea phpBB 2.0.2
- Permite ordonare dupa data
Am incercat si
Topic Display Order v 1.0.2
- Creat de Ptirhiik < admin@rpgnet-fr.com>
- Testat pe versiunea phpBB 2.0.6
- Permite ordonare dupa titlu, autor, data
- Download: rpgnet.clanmckeen.com sau phpHacks
- Demo: http://rpgnet.clanmckeen.com/demo/viewtopic.php?t=514
Dar nu am observat ce trebuie sa fac dupa modificarile.
Cine este conectat
Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 23 vizitatori