Welcom on overall header

Download and support for PhpBB3 Welcome On Index
Locked
uzidesign
BBCoder II
BBCoder II
Posts: 13
Joined: 14 Aug 2010, 13:42

Welcom on overall header

Post by uzidesign »

Hi,

Can you help me with code?
I want to show welcome in all pages (search, viewtopic, viewforum etc')

Thanks
User avatar
Stoker
Site Admin
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

Post by Stoker »

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.
Board rules! No PM support
User avatar
kevinviet
BBCoder III
BBCoder III
Posts: 123
Joined: 06 Mar 2010, 04:52

Re: Welcom on overall header

Post by kevinviet »

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
User avatar
Stoker
Site Admin
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

Post by Stoker »

Its the same.
Board rules! No PM support
User avatar
kevinviet
BBCoder III
BBCoder III
Posts: 123
Joined: 06 Mar 2010, 04:52

Re: Welcom on overall header

Post by kevinviet »

Thanks, i have the latest version ;)
VOLKERMORD
BBCoder I
BBCoder I
Posts: 3
Joined: 10 Mar 2010, 15:54

Welcom on overall header

Post by VOLKERMORD »

Find in includes/functions.php

Code: Select all

    // The following assigns all _common_ variables that may be used at any point in a template. 
Before add:

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 . '&nbsp;' . $user->lang['WELCOME_YEARS'] . ', ') : ($years . '&nbsp;' . $user->lang['WELCOME_YEAR'] . ', ');
        }
        $months = floor($member_length / 2628000);
        if ($months)
        {
            $months = $months > 1 ? ($months . '&nbsp;' . $user->lang['WELCOME_MONTHS'] . ', ') : ($months . '&nbsp;' . $user->lang['WELCOME_MONTHS'] . ', ');
            $member_length = $member_length - ($months * 2628000);
            $member_for .= $months;
        }
        $days = floor($member_length / 86400);
        if ($days)
        {
            $days = $days > 1 ? ($days . '&nbsp;' . $user->lang['WELCOME_DAYS']) : ($days . '&nbsp;' . $user->lang['WELCOME_DAY']);
            $member_for .= $days;
        }       
    }
}
//END Welcome Mod
Find in includes/functions.php

Code: Select all

'S_USER_NEW'					=> $user->data['user_new'],
After add:

Code: Select all

 // BEGIN Welcome Mod   
    'S_WELCOME'                   => $s_welcome,
    'S_JOINED_DATE'               => $user->lang['JOINED'] . ':&nbsp;' . $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'] . '&nbsp;' . $member_for : '',
   	// END Welcome Mod 
use this code in your overall_header.html

Code: Select all

<!-- IF USER_AVATAR -->{USER_AVATAR}<!-- ELSE --><img src="{T_THEME_PATH}/images/no_avatar.gif" width="45px" height="45px" alt="" /><!-- ENDIF -->
User avatar
martin123456
BBCoder VI
BBCoder VI
Posts: 765
Joined: 25 Jul 2011, 13:29
BBCodes: 34
Favourite MOD: Ban button
Location: Down south!
Contact:

Welcom on overall header

Post by martin123456 »

failed on my test board unless i put this part

<!-- 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
VOLKERMORD
BBCoder I
BBCoder I
Posts: 3
Joined: 10 Mar 2010, 15:54

Welcom on overall header

Post by VOLKERMORD »

After I changed overall_header.html it is look very nice ;)
Image
Locked