REM
Пользователь
PHP:
ALTER TABLE `bb_users` ADD `user_profile_views` mediumint(8) NOT NULL;
Открываем usercp_viewprofile.php
Находим
if (empty($_GET[POST_USERS_URL]) || $_GET[POST_USERS_URL] == ANONYMOUS)
{
bb_die($lang['NO_USER_ID_SPECIFIED']);
}
if (!$profiledata = get_userdata($_GET[POST_USERS_URL]))
{
bb_die($lang['NO_USER_ID_SPECIFIED']);
}
Ниже добавляем
$sql = "UPDATE " . BB_USERS . "
SET user_profile_views = user_profile_views + 1
WHERE user_id = " . $profiledata['user_id'];
if ( !($result = DB()->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update profile views', '', __LINE__, __FILE__, $sql);
}
$sql = "SELECT user_profile_views
FROM " . BB_USERS . "
WHERE user_id = " . $profiledata['user_id'];
if ( !($result = DB()->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not retreive profile views', '', __LINE__, __FILE__, $sql);
}
$row = DB()->sql_fetchrow($result);
$total_profile_views = ( $row['user_profile_views'] ) ? $row['user_profile_views'] : 0;
DB()->sql_freeresult($result);
Находим
'AVATAR_IMG' => get_avatar($profiledata['user_avatar'], $profiledata['user_avatar_type'], !bf($profiledata['user_opt'], 'user_opt', 'allow_avatar')),
Ниже добавляем
'L_PROFILE_VIEWS' => $lang['PROFILE_VIEWS'],
'PROFILE_VIEWS' => $total_profile_views,
Открываем lang_main.php
В самый низ добавляем
$lang['PROFILE_VIEWS'] = 'Просмотров профиля';
Открываем usercp_viewprofile.tpl
Находим
<tr>
<th>{L_TOTAL_POSTS}:</th>
<td>
<p>
<b>{POSTS}</b>
[ <a href="{U_SEARCH_USER}" class="med">{L_SEARCH_USER_POSTS}</a> ]
[ <a href="{U_SEARCH_TOPICS}" class="med">{L_SEARCH_USER_TOPICS}</a> ]
[ <a class="med" href="{U_SEARCH_RELEASES}">{L_SEARCH_RELEASES}</a> ]
<!-- IF PROFILE_USER -->[ <a class="med" href="{U_WATCHED_TOPICS}">{L_WATCHED_TOPICS}</a> ]<!-- ENDIF -->
</p>
</td>
</tr>
Ниже добавляем
<tr>
<th>{L_PROFILE_VIEWS}:</th>
<td>{PROFILE_VIEWS}</td>
</tr>
Всё готово!