Würde das allerdings gerne im index in overlib anzeigen.
mit $profiledata im index zeigt er schwachsinn (letzer besuch vor knapp 2 millionen jahren
mit $userdata zeigt er MEINEN letzten besuch (also den letzten besuch des users, der gerade die seite anguckt!
wie kann ich $profiledata im index nutzen?!?
das macht die probleme:
Code: Alles auswählen
$last_seen_seconds = time() - $profiledata['user_lastvisit'];
Code: Alles auswählen
##############################################################
## MOD Title: Last seen mod
## MOD Version: 0.9 (beta)
## Author: AnonymousFool < nathr2001@yahoo.com > (Nathan Reynolds)
## Description: Alters the users profile to show the last time
## they logged into the site
##
## Installation Level: easy
## Installation Time: 5 Minutes
## Files To Edit: includes/usercp_viewprofile.php
## includes/constants.php
## language/lang_english/lang_main.php
## templates/subSilver/profile_view_body.tpl
##
## Included Files: n/a
##############################################################
## This MOD is released under the GPL License.
## Intellectual Property is retained by the MOD Author(s) listed above
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ 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/downloads/
##############################################################
## Authors Notes:
##
## It's not pretty, but it works :)
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_viewprofile.php
#
#-----[ FIND ]------------------------------------------
#
$template->assign_vars(array(
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$last_seen_seconds = time() - $profiledata['user_lastvisit'];
if ($last_seen_seconds < HOUR_SECONDS)
{
$last_seen = sprintf_spd($last_seen_seconds / MINUTE_SECONDS, $lang['Minute_ago'], $lang['Minutes_ago']);
}
else if ($last_seen_seconds < DAY_SECONDS)
{
$last_seen = sprintf_spd($last_seen_seconds / HOUR_SECONDS, $lang['Hour_ago'], $lang['Hours_ago']);
}
else if ($last_seen_seconds < WEEK_SECONDS)
{
$last_seen = sprintf_spd($last_seen_seconds / DAY_SECONDS, $lang['Day_ago'], $lang['Days_ago']);
}
else if ($last_seen_seconds < MONTH_SECONDS)
{
$last_seen = sprintf_spd($last_seen_seconds / WEEK_SECONDS, $lang['Week_ago'], $lang['Weeks_ago']);
}
else if ($last_seen_seconds < YEAR_SECONDS)
{
$last_seen = sprintf_spd($last_seen_seconds / MONTH_SECONDS, $lang['Month_ago'], $lang['Months_ago']);
}
else
{
$last_seen = sprintf_spd($last_seen_seconds / YEAR_SECONDS, $lang['Year_ago'], $lang['Years_ago']);
}
//
// Specialised version of sprintf - depending on $number,
// decides whether to apply $singular_fmt or $plural_fmt as
// the format
//
function sprintf_spd($number, $singular_fmt, $plural_fmt)
{
$number = intval($number);
return sprintf(($number == 1) ? $singular_fmt : $plural_fmt, $number);
}
#
#-----[ FIND ]------------------------------------------
#
'POSTER_RANK' => $poster_rank,
#
#-----[ BEFORE, ADD ]------------------------------------------
#
'LAST_SEEN' => $last_seen,
#
#-----[ FIND ]------------------------------------------
#
'L_JOINED' => $lang['Joined'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
'L_LAST_SEEN' => $lang['Last_seen'],
#
#-----[ OPEN ]------------------------------------------
#
includes/constants.php
#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
define('MINUTE_SECONDS', 60);
define('HOUR_SECONDS', MINUTE_SECONDS * 60);
define('DAY_SECONDS', HOUR_SECONDS * 24);
define('WEEK_SECONDS', DAY_SECONDS * 7);
// Going by the leap-year rules
define('YEAR_SECONDS', 365.2425);
define('MONTH_SECONDS', YEAR_SECONDS / 12);
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
//
// That's all Folks!
// -------------------------------------------------
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$lang['Last_seen'] = 'Last seen';
$lang['Minute_ago'] = '%d minute ago';
$lang['Minutes_ago'] = '%d minutes ago';
$lang['Hour_ago'] = '%d hour ago';
$lang['Hours_ago'] = '%d hours ago';
$lang['Day_ago'] = '%d day ago';
$lang['Days_ago'] = '%d days ago';
$lang['Week_ago'] = '%d week ago';
$lang['Weeks_ago'] = '%d weeks ago';
$lang['Month_ago'] = '%d month ago';
$lang['Months_ago'] = '%d months ago';
$lang['Year_ago'] = '%d year ago';
$lang['Years_ago'] = '%d years ago';
#
#-----[ 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_LAST_SEEN}: </span></td>
<td width="100%"><b><span class="gen">{LAST_SEEN}</span></b></td>
</tr>
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM