MyBB Community Forums

Full Version: Customizing Welcome Back
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I would like to customize the Welcome Back panel to look like the image below, but it appears that this line of code
$l['welcome_back'] = "<strong>Welcome back, {1}</strong>. You last visited: {2}";
is not allowing me to separate out the "You last visited" part. I've looked through the global.lang.php file, where I got the above code, and it looks like this was not programmed separately like "Current time."

I've gone into the template header_welcomeblock_member, and it looks relatively easy to reposition things if I can just figure out how to separate the "you last visited" from the "welcome, back."

This is what I'd like to do.
[Image: ForumControlPanel.jpg]

Thanks

Anyone?
Anyone?
Anyone have any ideas on this? This would be great if it's something that can be edited.
Try this:

1. Open
./inc/languages/your language/global.lang.php

2. Find:
$l['welcome_back'] = "<strong>Welcome back, {1}</strong>. You last visited: {2}";

3. Replace with:
$l['welcome_back'] = "<strong>Welcome back, {1}</strong>.";

4. Add this below:
$l['welcome_last_visit'] = "<strong>You last visited:</strong> {1}";

5. Open:
./global.php

6. Find:
$lang->welcome_back = $lang->sprintf($lang->welcome_back, build_profile_link($mybb->user['username'], $mybb->user['uid']), $lastvisit);

7. Replace with:
$lang->welcome_back = $lang->sprintf($lang->welcome_back, build_profile_link($mybb->user['username'], $mybb->user['uid']));

8. Add this below:
$lang->welcome_last_visit = $lang->sprintf($lang->welcome_last_visit, build_profile_link($lastvisit));

9. Open:
Admincp -> Templates & Style -> Templates -> Your Template Set -> Header Templates -> header_welcomeblock_member

10. Find:
<span style="float:right;">{$lang->welcome_current_time}</span>

11. Replace with:
<span style="float:right;">{$lang->welcome_current_time} <br /> {$lang->welcome_last_visit}</span>

You may need to alter it around a bit to get the effect that you want. Smile
Thanks, Vernier. I appreciate your taking the time to write this up.

This line of code
$l['welcome_last_visit'] = "<strong>You last visited:</strong> {2}"; 
shows the actual number {2} at the end instead of the real time. I tried changing it to a {1}, but that just shows a static time.

For example: You last visited: {2}

Any thoughts?
Odd, I tried this out my test board and it worked perfectly.

I did make a slight typo.

$l['welcome_last_visit'] = "<strong>You last visited:</strong> {2}"; 

Should be:
$l['welcome_last_visit'] = "<strong>You last visited:</strong> {1}";

Please could you provide your forum URL and a testing account and I'll take a look. Smile
Hey Vernier,

I tested it with {1}, and it appears to be working now. I tried the same thing last night, but it kept showing the same time. Does the time change on each login, or each refresh of the site?

You can view the site here:
http://modeltrainfactory.com/forum/

I'll PM you the test login info now.
That's the last visit. It will display when you last logged into the forums. Log out, then back in and it will change to the current time, and will stay like that until you log back in again. Smile
Thanks, Vernier. I really appreciate your help. Can this modification affect the who's online? I'm noticing that no one shows up for members who visited in the last 15 minutes.

It only shows the person logged in. I tested with my test account, and my admin account. They both should show up, but they don't.
No, it shouldn't affect the who's online in any way.

It's working fine for me:

http://i.imm.io/xNnA.png
Pages: 1 2