1 頁 (共 1 頁)

[分享] 最後登入時間

發表於 : 2006-08-10 11:10
chc223
加入竹貓星球也有一段時間了,感謝板上前輩的分享。
我在這得到很多需要的資訊,現在也該有所回饋了。

以下是我自己在會員列表中加入了顯示會員最後登入時間,
這個 mod 很簡單,只要更動兩個 files (其實我也只會這種簡單的) ;-)
1. memberlist.php
2. lang_main.php

(不知道板上是不是已經有人貼過一樣的 mod,如果有一樣的請板主把這篇刪了)

代碼: 選擇全部

#-----[ OPEN ]------------------------------------------------
#
memberlist.php
#
#-----[ FIND ]------------------------------------------------
#
$mode_types_text = array($lang['Sort_Joined'],

#-----[ INLINE, FIND ]------------------------------------------------
#
, $lang['Sort_Top_Ten']

#-----[ AFTER, ADD ]------------------------------------------------
#
, $lang['Last_Login_Time']

#-----[ FIND ]------------------------------------------------
#
$mode_types = array('joined',

#-----[ INLINE, FIND ]------------------------------------------------
#
, 'topten'

#-----[ AFTER, ADD ]------------------------------------------------
#
, 'lastlogin'

#-----[ FIND ]------------------------------------------------
#
	$select_sort_mode = '<select name="mode">';
	for($i = 0; $i < count($mode_types_text); $i++)
	{
		$selected = ( $mode == $mode_types[$i] ) ? ' selected="selected"' : '';
		$select_sort_mode .= '<option value="' . $mode_types[$i] . '"' . $selected . '>' . $mode_types_text[$i] . '</option>';
	}
	$select_sort_mode .= '</select>';

#-----[ REPLACE WITH ]------------------------------------------------
#
if ( $userdata['user_level'] == ADMIN )
{
	$select_sort_mode = '<select name="mode">';
	for($i = 0; $i < count($mode_types_text); $i++)
	{
		$selected = ( $mode == $mode_types[$i] ) ? ' selected="selected"' : '';
		$select_sort_mode .= '<option value="' . $mode_types[$i] . '"' . $selected . '>' . $mode_types_text[$i] . '</option>';
	}
	$select_sort_mode .= '</select>';
}
else
{
	$select_sort_mode = '<select name="mode">';
	for($i = 0; $i < count($mode_types_text)-1; $i++)
	{
		$selected = ( $mode == $mode_types[$i] ) ? ' selected="selected"' : '';
		$select_sort_mode .= '<option value="' . $mode_types[$i] . '"' . $selected . '>' . $mode_types_text[$i] . '</option>';
	}
	$select_sort_mode .= '</select>';
}

#-----[ FIND ]------------------------------------------------
#
'L_JOINED' =>  $lang['Joined'] ,

#-----[ REPLACE WITH ]------------------------------------------------
#
'L_JOINED' => ( ($mode == 'lastlogin') ? $lang['Last_Login_Time'] : $lang['Joined'] ),

#-----[ FIND ]------------------------------------------------
#
	default:
		$order_by = "user_regdate $sort_order LIMIT $start, " . $board_config['topics_per_page'];
		break;

#-----[ BEFORE, ADD ]------------------------------------------------
#
	case 'lastlogin':
		$order_by = "user_regdate $sort_order LIMIT $start, " . $board_config['topics_per_page'];
		$where_is = "user_active <> 0";
		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, user_level
		FROM " . USERS_TABLE . "
		WHERE user_id <> " . ANONYMOUS . "
		ORDER BY $order_by";

#-----[ REPLACE WITH ]------------------------------------------------
#
if ( $mode == 'lastlogin' )
{
	$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, user_level, user_session_time
		FROM " . USERS_TABLE . "
		WHERE user_id <> " . ANONYMOUS . " AND $where_is
		ORDER BY $order_by";
}
else
{
	$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, user_level, user_session_time
		FROM " . USERS_TABLE . "
		WHERE user_id <> " . ANONYMOUS . "
		ORDER BY $order_by";
}

#-----[ FIND ]------------------------------------------------
#
$joined = create_date($lang['DATE_FORMAT'], $row['user_regdate'], $board_config['board_timezone']);

#-----[ REPLACE WITH ]------------------------------------------------
#
$joined = ($mode == 'lastlogin') ? ( ($row['user_session_time']) ? create_date('m/d/y h:i a', $row['user_session_time'], $board_config['board_timezone']) : $lang['Not_Login']) : create_date($lang['DATE_FORMAT'], $row['user_regdate'], $board_config['board_timezone']);

#-----[ OPEN ]------------------------------------------------
#
language/lang_chinese_traditional_taiwan/lang_main.php

#-----[ FIND ]------------------------------------------------
#
?>

#-----[ BEFORE, ADD ]------------------------------------------------
#
$lang['Last_Login_Time'] = '最後登入時間';
$lang['Not_Login'] = '不曾登入';

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM