mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 05:43:55 -07:00
Merge pull request #539 from torrentpier/user-birthday-icon-profile
Added user birthday icon in profile
This commit is contained in:
commit
bd9561fc42
4 changed files with 21 additions and 5 deletions
|
@ -2092,3 +2092,21 @@ function clean_tor_dirname($dirname)
|
||||||
{
|
{
|
||||||
return str_replace(array('[', ']', '<', '>', "'"), array('[', ']', '<', '>', '''), $dirname);
|
return str_replace(array('[', ']', '<', '>', "'"), array('[', ']', '<', '>', '''), $dirname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get birthday icon
|
||||||
|
*
|
||||||
|
* @param $user_birthday
|
||||||
|
* @param $user_id
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function user_birthday_icon($user_birthday, $user_id): string
|
||||||
|
{
|
||||||
|
global $bb_cfg, $images, $lang;
|
||||||
|
|
||||||
|
$current_date = bb_date(TIMENOW, 'md', false);
|
||||||
|
$user_birthday = ($user_id != GUEST_UID && !empty($user_birthday) && $user_birthday != '1900-01-01')
|
||||||
|
? date('md', strtotime($user_birthday)) : false;
|
||||||
|
|
||||||
|
return ($bb_cfg['birthday_enabled'] && $current_date == $user_birthday) ? '<img src="' . $images['icon_birthday'] . '" alt="" title="' . $lang['HAPPY_BIRTHDAY'] . '" border="0" />' : '';
|
||||||
|
}
|
||||||
|
|
|
@ -99,6 +99,7 @@ $template->assign_vars(array(
|
||||||
'USER_POINTS' => $profiledata['user_points'],
|
'USER_POINTS' => $profiledata['user_points'],
|
||||||
'GENDER' => ($bb_cfg['gender']) ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '',
|
'GENDER' => ($bb_cfg['gender']) ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '',
|
||||||
'BIRTHDAY' => ($bb_cfg['birthday_enabled'] && !empty($profiledata['user_birthday']) && $profiledata['user_birthday'] != '1900-01-01') ? $profiledata['user_birthday'] : '',
|
'BIRTHDAY' => ($bb_cfg['birthday_enabled'] && !empty($profiledata['user_birthday']) && $profiledata['user_birthday'] != '1900-01-01') ? $profiledata['user_birthday'] : '',
|
||||||
|
'BIRTHDAY_ICON' => user_birthday_icon($profiledata['user_birthday'], $profiledata['user_id']),
|
||||||
'AGE' => ($bb_cfg['birthday_enabled'] && !empty($profiledata['user_birthday']) && $profiledata['user_birthday'] != '1900-01-01') ? birthday_age($profiledata['user_birthday']) : '',
|
'AGE' => ($bb_cfg['birthday_enabled'] && !empty($profiledata['user_birthday']) && $profiledata['user_birthday'] != '1900-01-01') ? birthday_age($profiledata['user_birthday']) : '',
|
||||||
|
|
||||||
'L_VIEWING_PROFILE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']),
|
'L_VIEWING_PROFILE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']),
|
||||||
|
|
|
@ -221,6 +221,7 @@ ajax.callback.gen_passkey = function(data){
|
||||||
{RANK_IMAGE}
|
{RANK_IMAGE}
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
</p>
|
</p>
|
||||||
|
<!-- IF BIRTHDAY_ICON --><div class="mrg_8">{BIRTHDAY_ICON}</div><!-- ENDIF -->
|
||||||
<h4 class="cat border bw_TB" id="username">{L_CONTACT} <span class="editable bold">{USERNAME}</span></h4>
|
<h4 class="cat border bw_TB" id="username">{L_CONTACT} <span class="editable bold">{USERNAME}</span></h4>
|
||||||
|
|
||||||
<div class="spacer_4"></div>
|
<div class="spacer_4"></div>
|
||||||
|
|
|
@ -566,13 +566,9 @@ if ($topic_has_poll) {
|
||||||
|
|
||||||
$prev_post_time = $max_post_time = 0;
|
$prev_post_time = $max_post_time = 0;
|
||||||
|
|
||||||
$this_date = bb_date(TIMENOW, 'md', false);
|
|
||||||
|
|
||||||
for ($i = 0; $i < $total_posts; $i++) {
|
for ($i = 0; $i < $total_posts; $i++) {
|
||||||
$poster_id = $postrow[$i]['user_id'];
|
$poster_id = $postrow[$i]['user_id'];
|
||||||
$poster = ($poster_id == GUEST_UID) ? $lang['GUEST'] : $postrow[$i]['username'];
|
$poster = ($poster_id == GUEST_UID) ? $lang['GUEST'] : $postrow[$i]['username'];
|
||||||
$poster_birthday = ($poster_id != GUEST_UID && !empty($postrow[$i]['user_birthday']) && $postrow[$i]['user_birthday'] != '1900-01-01')
|
|
||||||
? date('md', strtotime($postrow[$i]['user_birthday'])) : '';
|
|
||||||
$post_date = bb_date($postrow[$i]['post_time'], $bb_cfg['post_date_format']);
|
$post_date = bb_date($postrow[$i]['post_time'], $bb_cfg['post_date_format']);
|
||||||
$max_post_time = max($max_post_time, $postrow[$i]['post_time']);
|
$max_post_time = max($max_post_time, $postrow[$i]['post_time']);
|
||||||
$poster_posts = ($poster_id != GUEST_UID) ? $postrow[$i]['user_posts'] : '';
|
$poster_posts = ($poster_id != GUEST_UID) ? $postrow[$i]['user_posts'] : '';
|
||||||
|
@ -732,7 +728,7 @@ for ($i = 0; $i < $total_posts; $i++) {
|
||||||
'DELETE' => $delpost_btn,
|
'DELETE' => $delpost_btn,
|
||||||
'IP' => $ip_btn,
|
'IP' => $ip_btn,
|
||||||
|
|
||||||
'POSTER_BIRTHDAY' => ($bb_cfg['birthday_enabled'] && $this_date == $poster_birthday) ? '<img src="' . $images['icon_birthday'] . '" alt="" title="' . $lang['HAPPY_BIRTHDAY'] . '" border="0" />' : '',
|
'POSTER_BIRTHDAY' => user_birthday_icon($postrow[$i]['user_birthday'], $postrow[$i]['user_id']),
|
||||||
|
|
||||||
'MC_COMMENT' => ($mc_type) ? bbcode2html($mc_comment) : '',
|
'MC_COMMENT' => ($mc_type) ? bbcode2html($mc_comment) : '',
|
||||||
'MC_BBCODE' => ($mc_type) ? $mc_comment : '',
|
'MC_BBCODE' => ($mc_type) ? $mc_comment : '',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue