![[IMG]](http://tutweb.ru/uploads/posts/2010-11/1289408279_viewed-profile-picture-foto-smotrevshix-profil-dlya-socialengine-3.20.png)
Viewed Profile Picture - простая модификация добавляющая вывод фотографий пользователей, которые просматривали ваш профиль в SocialEngine 3.20+.
Открываем user_home.php
там находим
PHP:
// RETRIEVE VIEWS AND VIEWERS IF NECESSARY
$profile_views = 0; $profile_viewers = Array();
$view_query = $database->database_query("SELECT profileview_views, profileview_viewers FROM se_profileviews WHERE profileview_user_id='{$user->user_info['user_id']}'"); if($database->database_num_rows($view_query) == 1) { $views = $database->database_fetch_assoc($view_query);
$profile_views = $views['profileview_views'];
if($views['profileview_viewers'] == "") { $views['profileview_viewers'] = "''";
}
$viewer_query = $database->database_query("SELECT user_id, user_username, user_fname, user_lname FROM se_users WHERE user_id IN ({$views['profileview_viewers']})"); while($viewer_info = $database->database_fetch_assoc($viewer_query)) {$viewer = new se_user();
$viewer->user_info['user_id'] = $viewer_info['user_id'];
$viewer->user_info['user_username'] = $viewer_info['user_username'];
$viewer->user_info['user_fname'] = $viewer_info['user_fname']; $viewer->user_info['user_lname'] = $viewer_info['user_lname']; $viewer->user_displayname();
// SET PROFILE VIEWERS
$profile_viewers[] = $viewer; } $profile_viewers_array = explode(",", $views['profileview_viewers']); usort($profile_viewers, create_function('$a,$b', 'global $profile_viewers_array; if(array_search($a->user_info["user_id"], $profile_viewers_array) == array_search($b->user_info["user_id"], $profile_viewers_array)) { return 0; } else { return (array_search($a->user_info["user_id"], $profile_viewers_array) < array_search($b->user_info["user_id"], $profile_viewers_array)) ? -1 : 1; }')); }
и заменяем на это
PHP:
// RETRIEVE VIEWS AND VIEWERS IF NECESSARY
$profile_views = 0; $profile_viewers = Array();
$view_query = $database->database_query("SELECT profileview_views, profileview_viewers FROM se_profileviews WHERE profileview_user_id='{$user->user_info['user_id']}'");
if($database->database_num_rows($view_query) == 1) { $views = $database->database_fetch_assoc($view_query);
$profile_views = $views['profileview_views'];
if($views['profileview_viewers'] == "") { $views['profileview_viewers'] = "''";
}
$viewer_query = $database->database_query("SELECT user_id, user_photo, user_username, user_fname, user_lname FROM se_users WHERE user_id IN ({$views['profileview_viewers']})"); while($viewer_info = $database->database_fetch_assoc($viewer_query)) { $viewer = new se_user();
$viewer->user_info['user_id'] = $viewer_info['user_id'];
$viewer->user_info['user_photo'] = $viewer_info['user_photo'];
$viewer->user_info['user_username'] = $viewer_info['user_username'];
$viewer->user_info['user_fname'] = $viewer_info['user_fname'];
$viewer->user_info['user_lname'] = $viewer_info['user_lname'];
$viewer->user_displayname();
// SET PROFILE VIEWERS
$profile_viewers[] = $viewer; } $profile_viewers_array = explode(",", $views['profileview_viewers']); usort($profile_viewers, create_function('$a,$b', 'global $profile_viewers_array; if(array_search($a->user_info["user_id"], $profile_viewers_array) == array_search($b->user_info["user_id"], $profile_viewers_array)) { return 0; } else { return (array_search($a->user_info["user_id"], $profile_viewers_array) < array_search($b->user_info["user_id"], $profile_viewers_array)) ? -1 : 1; }')); }
после открываем user_home.tpl
находим вот это
PHP:
{* SHOW NUMBER OF TIMES PROFILE HAS BEEN VIEWED *}
<div><img src='./images/icons/newviews16.gif' border='0' class='icon' />{lang_sprintf id=740 1=$profile_views}{if $profile_viewers != 0}[ <a href='user_home.php?task=resetviews'>{lang_print id=741}</a> ]{/if}
{* WHO VIEWED MY PROFILE LINK *}
{if $user->user_info.user_saveviews == 1}{if $profile_viewers|@count != 0}<div style='margin-top: 10px;'> <a href='javascript:void(0);' onclick="$('profile_viewers').style.display='block';this.style.display='none';">{lang_print id=1064}</a><div id='profile_viewers' style='display: none; max-height: 400px; overflow: auto;'> {lang_print id=1182}{section name=viewer_loop loop=$profile_viewers} <a href='{$url->url_create("profile", $profile_viewers[viewer_loop]->user_info.user_username)}'>{$profile_viewers[viewer_loop]->user_displayname}</a>{if $smarty.section.viewer_loop.last !== TRUE}, {/if}{/section}</div></div>{else} {lang_print id=1063}{/if}{/if}</div></td></tr> </table><div class='spacer10'></div>
и заменяем на это
PHP:
{* SHOW NUMBER OF TIMES PROFILE HAS BEEN VIEWED *}
{if $user->user_info.user_saveviews == 1}{if $profile_viewers|@count != 0}<table cellpadding='0' cellspacing='0' width='100%'><tr><td class='header'><img src='./images/icons/newviews16.gif' border='0' class='icon' /> {lang_print id=739}</td></tr><tr><tdclass='home_box'><div>{lang_sprintf id=740 1=$profile_views}
{* WHO VIEWED MY PROFILE LINK *}
<div style='border-top:1px solid #DDDDDD; padding-top:5px; margin-top: 10px;'><a href='javascript:void(0);' onclick="$('profile_viewers').style.display='block';this.style.display='none';">{lang_print id=1064}</a><div id='profile_viewers' style='display: none; max-height: 400px; overflow: auto;'>{section name=viewer_loop loop=$profile_viewers}<a style='color:#333' href='{$url->url_create("profile", $profile_viewers[viewer_loop]->user_info.user_username)}'><img src='{$profile_viewers[viewer_loop]->user_photo('./images/nophoto.gif', TRUE)}' border='0' width='40' height='40'></a>{if $smarty.section.viewer_loop.last !== TRUE} {/if}{/section} </div></div></div></td></tr></table><div class='spacer10'></div>{/if}{/if}