als de session time niet 0 is (de user is wel eens ingelogd) wordt $last_visit de session_time (van de vorige sessie dus want da tabel is nog niet geupdate).
vervolgens wordt de tabel geupdate, in user_sessione_time staat nu de huidige timestamp en in user_lastvisit staat de timestamp van de keer ervoor. dit heeft phpbb nodig om te controlleren welke berichten nieuw zijn en welke niet.
voor de last visit mod willen we echter de tijd hebben van het moment dat een user inlogd, de user_session_time dus en niet de user_lastvisit.
Code: Selecteer alles
##############################################################
## MOD Title: Last Visited
## MOD Author: imrich < forward_imrich@comcast.net > (Rich)
## MOD Description: This mod will change the memberlist, topicview (posts), and user profile to display the date of the members last visit in addition to the date they joined. It also allows the memberlist to be sorted based on the lastvisit date. Only the SubSilver template has been modified.
## MOD Version: 1.0.7
##
## Installation Level: Easy
## Installation Time: 20 minutes
## Files To Edit: memberlist.php
## viewtopic.php
## includes/usercp_viewprofile.php
## includes/page_header.php
## language/lang_english/lang_main.php
## templates/subSilver/memberlist_body.tpl
## templates/subSilver/profile_view_body.tpl
## templates/subSilver/viewtopic_body.tpl
## Included Files:
## Generator: MOD Studio 3.0 Alpha 1 [mod functions 0.2.1677.25348]
##############################################################
## 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 is an easy mod. I wanted the ability to see when a user last visited my forum. To me this is more important than knowing the date when a user first joined. Only the SubSilver template and English language files have been modified.
##############################################################
## MOD History:
##
## 2004-11.25 - Version 1.0.7
##
## Had error in FIND, misplaced comment delimiter
##
## 2004-11.25 - Version 1.0.6
##
## Had error in INLINE ADD, fixed syntax
##
## 2004-11-25 - Version 1.0.5
##
## Changed to also display last visit date when viewing posts.
## Updated changes to lang_main.php, additional changes to viewtopic.php and viewtopic_body.tpl
##
## 2004-11-23 - Version 1.0.4
##
## Removed single quotes around sql field.
##
## 2004-11-22 - Version 1.0.3
##
## Fixed catBottom length (cosmetic issue).
##
## 2004-11-20 - Version 1.0.2
##
## Fixed a couple of out of place comment delimiters.
##
## 2004-11-17 - Version 1.0.1
##
## Changed REPLACE to INLINE directives.
##
## 2004-11-09 - Version 1.0.0
##
## - First Stable release. Version 1.0.0 of a MOD is always it's first stable release.
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
memberlist.php
#
#
#-----[ FIND ]------------------------------------------
#
$mode_types_text = array($lang['Sort_Joined'], $lang['Sort_Username'], $lang['Sort_Location'], $lang['Sort_Posts'], $lang['Sort_Email'], $lang['Sort_Website'], $lang['Sort_Top_Ten']);
#
#-----[ IN-LINE FIND ]------------------------------------------
#
$mode_types_text = array($lang['Sort_Joined'],
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
$lang['Sort_Visited'],
#
#-----[ FIND ]------------------------------------------
#
$mode_types = array('joindate', 'username', 'location', 'posts', 'email', 'website', 'topten');
#
#-----[ IN-LINE FIND ]------------------------------------------
#
$mode_types = array('joindate',
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
'visitdate',
#
#-----[ FIND ]------------------------------------------
#
case 'joined':
$order_by = "user_regdate $sort_order LIMIT $start, " . $board_config['topics_per_page'];
break;
#
#-----[ AFTER, ADD ]------------------------------------------
#
case 'visitdate':
$order_by = "user_session_time $sort_order LIMIT $start, " . $board_config['topics_per_page'];
break;
#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email, user_icq, user_aim, user_yim, user_msnm, user_avatar, user_avatar_type, user_allowavatar
#
#-----[ IN-LINE FIND ]------------------------------------------
#
$sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate,
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
user_session_time,
#
#-----[ FIND ]------------------------------------------
#
$from = ( !empty($row['user_from']) ) ? $row['user_from'] : ' ';
$joined = create_date($lang['DATE_FORMAT'], $row['user_regdate'], $board_config['board_timezone']);
#
#-----[ AFTER, ADD ]------------------------------------------
#
// If user_session_time is zero, then user has never visited.
if($row['user_session_time']==0)
{
$lastvisit = '---------';
}
else
{
$lastvisit = create_date($lang['DATE_FORMAT'], $row['user_session_time'], $board_config['board_timezone']);
}
#
#-----[ FIND ]------------------------------------------
#
'USERNAME' => $username,
'FROM' => $from,
'JOINED' => $joined,
#
#-----[ AFTER, ADD ]------------------------------------------
#
'VISITED' => $lastvisit,
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid
#
#-----[ IN-LINE FIND ]------------------------------------------
#
u.user_regdate,
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
u.user_session_time,
#
#-----[ FIND ]------------------------------------------
#
$poster_joined = ( $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Joined'] . ': ' . create_date($lang['DATE_FORMAT'], $postrow[$i]['user_regdate'], $board_config['board_timezone']) : '';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$poster_visited = ( $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Visited'] . ': ' . create_date($lang['DATE_FORMAT'], $postrow[$i]['user_session_time'], $board_config['board_timezone']) : '';
#
#-----[ FIND ]------------------------------------------
#
'POSTER_JOINED' => $poster_joined,
#
#-----[ AFTER, ADD ]------------------------------------------
#
'POSTER_VISITED' => $poster_visited,
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_viewprofile.php
#
#-----[ FIND ]------------------------------------------
#
'USERNAME' => $profiledata['username'],
'JOINED' => create_date($lang['DATE_FORMAT'], $profiledata['user_regdate'], $board_config['board_timezone']),
#
#-----[ AFTER, ADD ]------------------------------------------
#
'VISITED' => $profiledata['user_session_time'] ? ( create_date($lang['DATE_FORMAT'], $profiledata['user_session_time'], $board_config['board_timezone'])) : '--------',
#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]------------------------------------------
#
'L_INDEX' => sprintf($lang['Forum_Index'], $board_config['sitename']),
'L_REGISTER' => $lang['Register'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
'L_VISITED' => $lang['Visited'],
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
$lang['Sort_Descending'] = 'Descending';
$lang['Order'] = 'Order';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['Visited'] = 'Last Visit';
$lang['Sort_Visited'] = 'Last Visit Date';
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/memberlist_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<th class="thTop" nowrap="nowrap">{L_FROM}</th>
<th class="thTop" nowrap="nowrap">{L_JOINED}</th>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<th class="thTop" nowrap="nowrap">{L_VISITED}</th>
#
#-----[ FIND ]------------------------------------------
#
<td class="{memberrow.ROW_CLASS}" align="center" valign="middle"><span class="gen">{memberrow.FROM}</span></td>
<td class="{memberrow.ROW_CLASS}" align="center" valign="middle"><span class="gensmall">{memberrow.JOINED}</span></td>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<td class="{memberrow.ROW_CLASS}" align="center" valign="middle"><span class="gensmall">{memberrow.VISITED}</span></td>
#
#-----[ FIND ]------------------------------------------
#
<td class="catBottom" colspan="8" height="28"> </td>
#
#-----[ IN-LINE FIND ]----------------------------------
#
colspan="8"
#
#-----[ IN-LINE REPLACE WITH ]----------------------------------
#
colspan="9"
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_view_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td valign="middle" align="right" nowrap="nowrap"><span class="gen">{L_JOINED}: </span></td>
<td width="100%"><b><span class="gen">{JOINED}</span></b></td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
<td valign="middle" align="right" nowrap="nowrap"><span class="gen">{L_VISITED}: </span></td>
<td width="100%"><b><span class="gen">{VISITED}</span></b></td>
</tr>
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/viewtopic_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<td width="150" align="left" valign="top" class="{postrow.ROW_CLASS}"><span class="name"><a name="{postrow.U_POST_ID}"></a><b>{postrow.POSTER_NAME}</b></span><br /><span class="postdetails">{postrow.POSTER_RANK}<br />{postrow.RANK_IMAGE}{postrow.POSTER_AVATAR}<br /><br />{postrow.POSTER_JOINED}<br />{postrow.POSTER_POSTS}<br />{postrow.POSTER_FROM}</span><br /></td>
#
#-----[ IN-LINE FIND ]----------------------------------
#
{postrow.POSTER_JOINED}<br />
#
#-----[ IN-LINE AFTER, ADD ]----------------------------------
#
{postrow.POSTER_VISITED}<br />
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM