Welcom on overall header
Welcom on overall header
Hi,
Can you help me with code?
I want to show welcome in all pages (search, viewtopic, viewforum etc')
Thanks
Can you help me with code?
I want to show welcome in all pages (search, viewtopic, viewforum etc')
Thanks
- Stoker
- Site Admin
- Posts: 3536
- Joined: 12 May 2008, 23:26
- BBCodes: 239
- Favourite BBCode: Anipro
- Favourite MOD: PrettyPhoto
- Location: Denmark
- Contact:
Re: Welcom on overall header
Basicly you need to put the index.php code in search.php etc.
The best way would be adding it to functions.php but that would require some custom coding.
The best way would be adding it to functions.php but that would require some custom coding.
Board rules! No PM support
Re: Welcom on overall header
Hi Stoker, this Welcome on index mod here is just the same version 1.0.2 in phpBB data base ? or you updated new version ?
Thanks
Thanks
Re: Welcom on overall header
Thanks, i have the latest version
-
- BBCoder I
- Posts: 3
- Joined: 10 Mar 2010, 15:54
Welcom on overall header
Find in includes/functions.php
Before add:
Find in includes/functions.php
After add:
use this code in your overall_header.html
Code: Select all
// The following assigns all _common_ variables that may be used at any point in a template.
Code: Select all
// BEGIN Welcome Mod
//--Welcome_Mod--get the hour number-->
$date = $user->format_date(time(), 'H');
if ($user->data['is_registered'])
{
$u_user_name = get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour']);
}
else
{
$u_user_name = $user->lang['WELCOME_GUEST'];
}
switch (true)
{
case ($date < 1):
// if the hour is 11am-12am (18-23)
$s_welcome = sprintf($user->lang['GOOD_NIGHT'], $u_user_name);;
break;
case ($date < 4):
// if the hour is 1-3 am
$s_welcome = sprintf($user->lang['UP_LATE'], $u_user_name);
break;
case ($date < 8):
// if the hour is 4-7 am
$s_welcome = sprintf($user->lang['UP_EARLY'], $u_user_name);
break;
case ($date < 12):
// if the hour is 8-11 am
$s_welcome = sprintf($user->lang['GOOD_MORNING'], $u_user_name);
break;
case ($date < 18):
// if the hour is 12-5pm
$s_welcome = sprintf($user->lang['GOOD_AFTERNOON'], $u_user_name);
break;
case ($date < 24):
// if the hour is 6pm-11pm
$s_welcome = sprintf($user->lang['GOOD_EVENING'], $u_user_name);;
break;
}
// how long a member for
$member_for = '';
if ($user->data['is_registered'] && !$user->data['is_bot'])
{
$member_length = time() - $user->data['user_regdate'];
$years = $months = $days = 0;
$member_for = '';
if ($member_length)
{
if ($member_length >= 31536000)
{
$years = floor($member_length / 31536000);
$member_length = $member_length - ($years * 31536000);
$member_for .= $years > 1 ? ($years . ' ' . $user->lang['WELCOME_YEARS'] . ', ') : ($years . ' ' . $user->lang['WELCOME_YEAR'] . ', ');
}
$months = floor($member_length / 2628000);
if ($months)
{
$months = $months > 1 ? ($months . ' ' . $user->lang['WELCOME_MONTHS'] . ', ') : ($months . ' ' . $user->lang['WELCOME_MONTHS'] . ', ');
$member_length = $member_length - ($months * 2628000);
$member_for .= $months;
}
$days = floor($member_length / 86400);
if ($days)
{
$days = $days > 1 ? ($days . ' ' . $user->lang['WELCOME_DAYS']) : ($days . ' ' . $user->lang['WELCOME_DAY']);
$member_for .= $days;
}
}
}
//END Welcome Mod
Code: Select all
'S_USER_NEW' => $user->data['user_new'],
Code: Select all
// BEGIN Welcome Mod
'S_WELCOME' => $s_welcome,
'S_JOINED_DATE' => $user->lang['JOINED'] . ': ' . $user->format_date($user->data['user_regdate']),
'USER_AVATAR' => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']),
'MEMBER_FOR' => (!empty($member_for)) ? $user->lang['MEMBER_FOR'] . ' ' . $member_for : '',
// END Welcome Mod
Code: Select all
<!-- IF USER_AVATAR -->{USER_AVATAR}<!-- ELSE --><img src="{T_THEME_PATH}/images/no_avatar.gif" width="45px" height="45px" alt="" /><!-- ENDIF -->
- martin123456
- BBCoder VI
- Posts: 765
- Joined: 25 Jul 2011, 13:29
- BBCodes: 34
- Favourite MOD: Ban button
- Location: Down south!
- Contact:
Welcom on overall header
failed on my test board unless i put this part
in the wrong place
<!-- IF USER_AVATAR -->{USER_AVATAR}<!-- ELSE --><img src="{T_THEME_PATH}/images/no_avatar.gif" width="45px" height="45px" alt="" /><!-- ENDIF -->
in the wrong place
-
- BBCoder I
- Posts: 3
- Joined: 10 Mar 2010, 15:54
Welcom on overall header
After I changed overall_header.html it is look very nice