Sidebar ayın üyesi destek
Gönderilme zamanı: 14 Tem 2021, 00:23
Sidebar ayın üyesi destek?
Alaattin abi bu ayın üyesi eklentisini bizde nasıl ekleyebiliriz?
Alaattin abi bu ayın üyesi eklentisini bizde nasıl ekleyebiliriz?
Kod: Tümünü seç
public function topuser_of_mounth()
{
// credit: threedi/tpotm
$now = time();
$date_today = gmdate("Y-m", $now);
list($year_cur, $month_cur) = explode('-', $date_today);
$month = (int) $month_cur -1;
$year = (int) $year_cur;
/*
// Top posters_ever (minus the present month) UTC - Thx Steve
$max_days = date( 't', gmmktime(23, 59, 59, $month, 1, $year) );
$end_last_month = gmmktime(23, 59, 59, $month, $max_days, $year);
*/
// Start time for current month
$month_start_cur = gmmktime (0,0,0, $month_cur, 1, $year_cur);
$month_start = $month_start_cur;
$month_end = $now;
/* Check cached data */
if (($topposter_posts = $this->cache->get('_topposter_posts')) === false)
{
$sql = 'SELECT u.username, u.user_id, u.user_colour, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, u.user_rank, MAX(u.user_type), p.poster_id, p.post_subject, MAX(p.post_time), p.post_id, COUNT(p.post_id) AS total_posts
FROM ' . USERS_TABLE . ' u, ' . POSTS_TABLE . ' p
WHERE u.user_id <> ' . ANONYMOUS . '
AND u.user_type <> ' . USER_FOUNDER . '
AND u.user_id = p.poster_id
AND p.post_visibility = ' . ITEM_APPROVED . '
AND p.post_time BETWEEN ' . (int) $month_start . ' AND ' . (int) $month_end . '
GROUP BY u.user_id
ORDER BY total_posts DESC, MAX(p.post_time) DESC';
$result = $this->db->sql_query_limit($sql, 1);
$topposter_posts = array();
while ($row = $this->db->sql_fetchrow($result))
{
$topposter_posts[] = $row;
}
$this->db->sql_freeresult($result);
// Cache for 5 min.
$this->cache->put('_topposter_posts', $topposter_posts, 300);
}
foreach( $topposter_posts as $row )
{
$topuser_posts = $row['total_posts'];
$username = ($this->auth->acl_get('u_viewprofile')) ? get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) : get_username_string('no_profile', $row['user_id'], $row['username'], $row['user_colour']);
get_user_rank($row['user_rank'], $row['user_posts'], $row['rank_title'], $row['rank_image'], $row['rank_image_src']);
$useravatar = get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']);
$post_subject = $row['post_subject'];
$post_id = $row['post_id'];
$post_link = append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", "p=" . $post_id . "#p" . $post_id);
$this->template->assign_block_vars('poster_ofmonth', array(
'S_TOPM' => empty($topuser_posts) ? false : true,
'S_SEARCH_ALLPOSTS' => append_sid("{$this->phpbb_root_path}search.$this->php_ext", 'author_id=' . $row['user_id'] . '&sr=posts'),
'TOPPOSTSUBJECT' => $post_subject,
'U_TOPPOSTSUBJECT' => $post_link,
'TOPUSER' => $username,
'TOPUSER_AVATAR' => $useravatar,
'TOPUSER_RANK' => $row['rank_title'],
'RANK_IMG_SRC' => $row['rank_image_src'],
'TOPM_POSTS_M' => $topuser_posts,
));
}
$this->template->assign_vars(array(
'S_TOPM' => empty($topuser_posts) ? false : true,
));
}Kod: Tümünü seç
{% if S_TP_MONTH %}
<div class="forabg">
<div class="inner">
<ul class="topiclist">
<li class="header">
<dl class="row-item">
<dt>
<i class="icon fa-trophy fa-fw" aria-hidden="true"></i>
</i>
{{ lang('TOPUSER_ACTUAL') }}
</dt>
</dl>
</li>
</ul>
<ul class="topiclist forums">
<li class="row-item">
<dl>
<dt>
<ul>
<div class="text_side">
{% if S_TOPM %}
{% for poster_ofmonth in poster_ofmonth %}
<div class="round_side">
{{ poster_ofmonth.TOPUSER_AVATAR }}<br />{{ poster_ofmonth.TOPUSER }}<br />{% if poster_ofmonth.TOPUSER_RANK %}<img src="{{ poster_ofmonth.RANK_IMG_SRC }}" /><br />{{ poster_ofmonth.TOPUSER_RANK }}{% endif %}
</div>
<div>
<strong>{{ lang('TOP_POST') }} {{ poster_ofmonth.TOPM_POSTS_M }}</strong><br />
<a href="{{ poster_ofmonth.S_SEARCH_ALLPOSTS }}" title="{{ lang('TOPUSER_ALL_POSTS') }}"><i class="icon fa-comments fa-fw" aria-hidden="true"></i>{{ lang('TOPUSER_ALL_POSTS') }}</a><br />
</div>
{% endfor %}
{% else %}
{{ lang('TOPUSER_NO_POSTS') }}
{% endif %}
</div>
</ul>
</dt>
</dl>
</li>
</ul>
</div>
</div>
{% endif %}
Kod: Tümünü seç
'TOP_POST' => 'Bu ay mesaj Sayısı:',
'TOP_POSTS' => 'Mesajlar',
'TOPUSER_ACTUAL' => 'Bu ayın üyesi',
'TOPUSER_ALL_POSTS' => 'Tüm mesajları',
'TOPUSER_NO_POSTS' => 'Ayın üyesi henüz yok',
Kod: Tümünü seç
'S_TP_MONTH' => $this->config['enable_tp_month'],
Kod: Tümünü seç
$this->template->assign_vars(array(
Kod: Tümünü seç
$this->sidebar->topuser_of_mounth();
Kod: Tümünü seç
AND u.user_type <> ' . USER_FOUNDER . '