2018-07-09, 09:50 AM
Hello
It will help me add some information to the plug-in code, such as the number of warn's, user's title and registration date, unfortunately I can not give myself advice anymore
It will help me add some information to the plug-in code, such as the number of warn's, user's title and registration date, unfortunately I can not give myself advice anymore
<?php
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
$plugins->add_hook("index_start", "statsuserindex");
function statsuserindex_info()
{
//info
$website = "https://mybboard.pl";
return array(
"name" => "Statystyki użytkownika na stronie głównej",
"description" => "---",
"website" => "{$website}",
"author" => "Snake_",
"authorsite" => "{$website}/uzytkownik-snake_19523",
"version" => "0.1",
);
}
function statsuserindex_activate()
{
}
function statsuserindex_deactivate()
{
}
function statsuserindex()
{
global $mybb, $cache, $statsuserlog, $theme, $groupscache, $lastvisit;
//ogolna funkcja
if($mybb->user['uid']) {
$tekst_wyswietlany_w_thead = "Statystyki użytkownika {$mybb->user['username']}.";
$nick_usera = build_profile_link(format_name($mybb->user['username'], $mybb->user['usergroup'], $mybb->user['displaygroup']), $mybb->user['uid']);
$nick_usera = "<span style=\"font-size: 20px;\">{$nick_usera}</span>";
$avatar_usera = '<img src="' . (empty($mybb->user['avatar']) ? 'images/default_avatar.png' : $mybb->user['avatar']) . '" title="' . $mybb->user['username'] . '" class="avatar_usera"/>';
$reputacja_usera = $mybb->user['reputation'];
$email_usera = "<a href=\"mailto:{$mybb->user['email']}\">{$mybb->user['email']}</a>";
$postow_usera = $mybb->user['postnum'];
}
else {
$tekst_wyswietlany_w_thead = "Twoje statystyki";
$nick_usera = "Gość";
$avatar_usera = '<img src="images/default_avatar.png" class="avatar_usera" />';
$reputacja_usera = 0;
$email_usera = "<i>Nie zidentyfikowano</i>";
$postow_usera = 0;
}
if(!is_array($groupscache))
$groupscache = $cache->read("usergroups");
$grupa_usera = $groupscache[$mybb->user['usergroup']]['title'];
$ostatnio_tu_bylem = $mybb->user['lastvisit'];
$ip = $_SERVER['REMOTE_ADDR'];
$statsuserlog = "
<table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" style=\"width: 100%;
border-left: 1px solid #393939;
border-right: 1px solid #393939;
border-bottom: 1px solid #393939;\">
<tr>
<td class=\"tcat\"><strong>
{$tekst_wyswietlany_w_thead}
</strong></td>
</tr>
<tr>
<td class=\"trow1\">
<div style=\"text-align: center;\">
{$nick_usera}
<br />
{$avatar_usera}
</div>
<br />
<div>
<div class=\"staty_author\"><div class=\"staty_left_a\">Grupa:</div><div class=\"staty_right_a\"> {$grupa_usera}</div></div>
<div class=\"staty_author\"><div class=\"staty_left_a\">Reputacja:</div><div class=\"staty_right_a\"> {$reputacja_usera}</div></div>
<div class=\"staty_author\"><div class=\"staty_left_a\">Liczba postów:</div><div class=\"staty_right_a\"> {$postow_usera}</div></div>
<div class=\"staty_author\"><div class=\"staty_left_a\">E-mail:</div><div class=\"staty_right_a\"> {$email_usera}</div></div>
<div class=\"staty_author\"><div class=\"staty_left_a\">Moje IP:</div><div class=\"staty_right_a\"> {$ip}</div></div>
<div class=\"staty_author\"><div class=\"staty_left_a\">Ostatnia wizyta:</div><div class=\"staty_right_a\"> {$lastvisit}</div></div>
</div>
</td>
</tr>
</table>";
}
?>