Re: Sidebar ayın üyesi destek
Gönderilme zamanı: 14 Tem 2021, 22:11
@kaptangula gelince görüşürüz inşallah..
Kod: Tümünü seç
// 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;Kod: Tümünü seç
// 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;
Kod: Tümünü seç
$this->template->assign_block_vars('poster_ofmonth', array(Kod: Tümünü seç
$this->template->assign_block_vars('poster_oflastmonth', array(Ati10 yazdı: 15 Ağu 2021, 23:21 Yukarıda anlatılan bloktan bir tane daha yap. sonra yeni yaptığın bu blokta aşağıdaki değişiklikleri yap:
bu ayın üyesi bloğunda bul (sidebar.php):geçen ayın üyesi için yaptığın blokta bu şekilde değiştir:Kod: Tümünü seç
// 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;ayrıca bazı kodların aynı olmamasında fayda var. mesela:Kod: Tümünü seç
// 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;
bunun yerine:bunu kullanabilirsin:Kod: Tümünü seç
$this->template->assign_block_vars('poster_ofmonth', array(Kod: Tümünü seç
$this->template->assign_block_vars('poster_oflastmonth', array(
Kod: Tümünü seç
//MONTH AYIN UYESI
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_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,
));
}
//MONTH AYIN UYESI END Kod: Tümünü seç
// credit: threedi/tpotm
// 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;
$max_days = date( 't', gmmktime(23, 59, 59, $month, 1, $year) );
// last month
$from_month = 2;
$to_month = 1;
$month_start = gmmktime(0, 0, 0, $month_cur-$from_month, $max_days, $year);
$month_end = gmmktime(23, 59, 59, $month_cur-$to_month, $max_days, $year);
Kod: Tümünü seç
/* Style the tab */
.tabtop {
overflow: hidden;
border: 1px solid #ccc;
background-color: #f1f1f1;
}
/* Style the buttons inside the tab */
.tabtop button {
background-color: inherit;
float: left;
width: 50%;
border: none;
outline: none;
cursor: pointer;
padding: 4px 6px;
transition: 0.3s;
font-size: 1.2em;
}
/* Change background color of buttons on hover */
.tabtop button:hover {
background-color: #ddd;
}
/* Create an active/current tablink class */
.tabtop button.active {
background-color: #ccc;
}
/* Create an active/current tablink class */
.tabtop button.activemobile {
background-color: #ccc;
}
/* Style the tab content */
.tabcontent {
display: none;
padding: 6px 12px;
border: 1px solid #ccc;
border-top: none;
}
.tabcontent-mobile {
display: none;
padding: 6px 12px;
border: 1px solid #ccc;
border-top: none;
}