PDA

View Full Version : Profile Enhancements - vB3.5 Local time and date in post and profile


Boofo
08-22-2005, 10:00 PM
vB3.5 Local time and date in post and profile
Version 1.0.1
(By Boofo)

What does this product do?
This product will add the local time and date of users in the posts and profile. That way you will know what the time and date is where they are located. I use this on my site so I will have an idea if it is the middle of the night, where they are at, or daytime. With your users living in all corners of the globe, this hack is a nice gauge of the different time zones without having to figure out each one in your head. ;)

Credits:
Thanks goes out to KirbyDE for pointing me in the right direction for the profile time and helping to verify the code. And everyone who chipped in at vbulletin.org to help me figure out vB3.5's new ways of doing things. A special thanks goes out to Chen Avinadav for making the first local time hack for vB2 and allowing me to release it for vB3 and vB3.5. ;)

Version Information:
Version 1.0.0 --Initial release
Version 1.0.1 --Fixed time where it didn't show right for many people. Thanks to Kirby for the fix. ;)

Installation overview:
Templates to edit: (3)
--postbit
--postbit_legacy
--memberinfo
Products to install: (1)

bleodler
08-22-2005, 11:21 PM
Installed and working great on my test board. :)

Boofo
08-22-2005, 11:29 PM
You had doubts? LOL

bleodler
08-22-2005, 11:34 PM
lol, actually maybe I spoke to soon or it's probably something on my end, but the times are 4 hours earlier than they should be.

Boofo
08-22-2005, 11:44 PM
Make sure your Default Time Zone Offset in the Date and Time settings in the vBulletin Options is set at your true server time. ;)

bleodler
08-23-2005, 12:03 AM
Make sure your Default Time Zone Offset in the Date and Time settings in the vBulletin Options is set at your true server time. ;)

They are the same unless DST is messing it up.

http://www.britfugees.com/vb.jpg

http://www.britfugees.com/server.jpg

wilky49
08-23-2005, 12:28 AM
Also make sure that the time zone is correct in your user settings

User CP / Edit options

Boofo
08-23-2005, 12:44 AM
Is it off both in the postbit AND the profile?

bleodler
08-23-2005, 01:01 AM
Is it off both in the postbit AND the profile?

Yes, they are both behind by 4 hours.

Boofo
08-23-2005, 01:03 AM
Does the time show right in the footer?

bleodler
08-23-2005, 01:09 AM
Does the time show right in the footer?

Yes

I could pm you the info to access my test board if you would like.

Scooterpig
08-23-2005, 04:28 AM
Well my test one is behind by 10 hours...yes footer time is right and usercp & admincp times r the same..:(

GrendelKhan{TSU
08-23-2005, 06:34 AM
Seems to work when using ENGLISH,
but it gives me weird percentage things when I switch to KOREAN (my default language pack):

Local Time: %0:%Aug %p
Local Date: %24-%08-%2005

:/

thoughts suggestions?

GrendelKhan{TSU
08-23-2005, 06:46 AM
hmmm...
very useful, but I have to uninstall for now.

I got the wrong time too. (it SEEMS to be adding the forum default time and the USER CP settings time).

also, as I said, above it seems to break when using a different language pack (important for me cause I have a multilanguage site.)

but DEFININTELY will install again when that get sorted out. good idea!! :D ^^ :D

Gizmo5h1t3
08-23-2005, 08:09 AM
my time is out with this as well...
mine is set at GMT, yet in the postbit, its GMT +1

on the index, the time displays correctly however....

Xplorer4x4
08-23-2005, 09:08 AM
*instaled* BUT I only instaled the templeate mod for memberinfo. It will clutter up the postbits IMO.

Boofo
08-23-2005, 09:26 AM
my time is out with this as well...
mine is set at GMT, yet in the postbit, its GMT +1

on the index, the time displays correctly however....

Sounds like a DST setting problem for you. Check the setting in the User CP.

Boofo
08-23-2005, 09:26 AM
*instaled* BUT I only instaled the templeate mod for memberinfo. It will clutter up the postbits IMO.

Is the time working right for you?

GrendelKhan{TSU
08-24-2005, 01:27 AM
any ideas why this is happening?

Local Time: %0:%Aug %p
Local Date: %24-%08-%2005


?

weirdness

Gizmo5h1t3
08-24-2005, 06:16 AM
Sounds like a DST setting problem for you. Check the setting in the User CP.
nope, read all the posts before my original one, started changing the DST settings, and it makes no difference....

if i set my user cp settings to the same as the board...ie....GMT...and set the DST setting to whatever option, it makes no difference..
trust me, it doesnt work..

always stays 1 hour ahead of the correct time....

Scooterpig
08-24-2005, 06:31 AM
Sorry Boofo can't work it out at all, still big time difference so had to remove.

Gizmo5h1t3
08-24-2005, 06:40 AM
Seems like everyones having the problem mate....

we cant ALL be getting the settings incorrect????

*EDIT*

REMOVED

Boofo
08-24-2005, 09:05 AM
Think about that statement, not everyone is having the same problem. Only those that are having a problem reported it here. Myself and a few others are not having any problem at all, so there must be an answer somewhere and I will find it. ;)

Is anyone having problems using Windows on their server? We have to start somewhere, I guess.

Gizmo5h1t3
08-25-2005, 06:18 AM
jeez man, dont have babies!!

im not critizing it at all, i appreciate the work u do on here...

if i didnt post, then u wouldnt be aware of the problem....

aethro
08-25-2005, 06:21 AM
Same problems as others are having, VB Reports correct time in footer however your addon shows it 8 hours off what it's susposed to be. My webserver's running FreeBSD.

Da Chang Gang
08-25-2005, 02:02 PM
You should at least put a specific place where to put it in the Postbit and Postbit legacy.

Boofo
08-25-2005, 02:22 PM
Everybody's postbit is not the same as mine. It is up to you where you want to use it.

concreteweb
08-25-2005, 03:15 PM
Hi Boofo,

Yes, same here. We are 7 hours off. All settings correct on the server and user control panel.

Boofo
08-25-2005, 03:17 PM
This is wierd. It works right for me and some others and doesn't for the rest of you. I am stumped, although I'm sure I will get it figured out.

mcyates
08-26-2005, 01:35 PM
Yes i have the same problem as evryone else

mcyates
08-26-2005, 01:43 PM
it just seems to be showing the server time which is -4 GMT I have set this on the settings, and in my options i have put GMT with day light savings active. It doesn't work.

Xplorer4x4
08-28-2005, 06:20 AM
Nope Boofo, it is not working. I set the default time to eastern time seeing as my servers are located in New York. I checked with one of my mbers and his time is listed as 9:18PM when it is 3:18 there. As I said before I only installed this in my meber info tepmplate.

Boofo
08-28-2005, 06:33 AM
it just seems to be showing the server time which is -4 GMT I have set this on the settings, and in my options i have put GMT with day light savings active. It doesn't work.

You lost me. You have GMT set as your time in the User CP?

mcyates
08-28-2005, 06:38 PM
You lost me. You have GMT set as your time in the User CP?

sorry that was very confusing. In admin cp the Default Time Zone Offset is on GMT. But the server is 4 hours behind. So if my time was 12:00 then it would be showing 08:00 on the local time. So its always 4 hours behind, Unless you change your setting to GMT +4 then the time will be correct.

For example its 18:00 and my setting is on GMT, my local time is showing 14:00. I then go into usercp and change my setting from GMT to GMT+4 my time now shows 18:00 which is the correct time BUT my settings are not correct, they are set to GMT+4 when i live in UK which is GMT.

Doe this help?

mcyates
08-28-2005, 06:40 PM
So basically to get the time to show correctly I have to put my settings 4 hours ahead of what they actually are as my server is 4 hours behind. But now the time at the bottom of the vbuklletin pages are 4 hours ahead. lol!!

Boofo
08-28-2005, 07:27 PM
The setting in my vBulletin Options are what the server time is at. My server is set at GMT, although I am in CST (USA). So I set my vBulletion Options time at GMT, which is the actual server time. Try setting the vB options setting to your actual sever time and see if that makes it right then.

Paul M
08-28-2005, 07:32 PM
The time is probably 4 hours out because the code does not take into account the local servers timezone. It needs to be extracted using date('Z', TIMENOW) and applied as a correction.

I would also consider removing this from the code ;

if (substr($userinfo['tzoffset'], 0, 1) != '-')
{
// recorrect so that it has + sign, if necessary
$userinfo['tzoffset'] = '+' . $userinfo['tzoffset'];
}
It's purely for display purposes and not really required for the calculations in this hack. :)

Boofo
08-28-2005, 07:34 PM
The time is probably 4 hours out because the code does not take into account the local servers timezone. It needs to be extracted using date('Z', TIMENOW) and applied as a correction.

I would also consider removing this from the code ;

if (substr($userinfo['tzoffset'], 0, 1) != '-')
{
// recorrect so that it has + sign, if necessary
$userinfo['tzoffset'] = '+' . $userinfo['tzoffset'];
}
It's purely for display purposes and not really required for the calculations in this hack. :)

I'm not sure I understand what you are getting at. Please PM me with the details if you would, sir. ;)

Paul M
08-28-2005, 08:10 PM
I'm not sure I understand what you are getting at. Please PM me with the details if you would, sir. ;)PM ? Okay :)

mcyates
08-29-2005, 05:48 AM
The setting in my vBulletin Options are what the server time is at. My server is set at GMT, although I am in CST (USA). So I set my vBulletion Options time at GMT, which is the actual server time. Try setting the vB options setting to your actual sever time and see if that makes it right then.

No it still makes no change, the times are still 4 hour s behind.

mcyates
09-04-2005, 06:59 AM
I take it this hack is dead then.

Boofo
09-04-2005, 05:59 PM
Not necessarily.

Boofo
09-06-2005, 06:06 AM
Uploaded new version that should fix the time being off for many people. Please let me know if it works for you all now. ;)

Scooterpig
09-06-2005, 06:50 AM
It works Boofo, well done, thank you..:)

Intrepid clicks Install..:)

Boofo
09-06-2005, 06:53 AM
You're very welcome, sir. Sorry it took so long for the fix. ;)

Xplorer4x4
09-06-2005, 10:45 AM
Looks liek you got that one hour problem fixed boofo. Thanks.

Boofo
09-06-2005, 10:54 AM
And the times shouldn't change when you are logged out now. ;)

peterska2
09-07-2005, 09:53 PM
/me clicks install

Xplorer4x4
09-26-2005, 10:18 AM
It is running 5 hours behind for me now. :( I will verify my server and main vb tiem zone match up but I believe it is a proble due to RC3.

Boofo
09-26-2005, 10:26 AM
It is running 5 hours behind for me now. :( I will verify my server and main vb tiem zone match up but I believe it is a proble due to RC3.

Then you have something else interfering with it then. There's no way it can be off with the code Kirby fixed. I'm also running it on RC 3 and it is right on the dot. ;)

Crow
09-28-2005, 03:54 AM
clicks install.. nice one! :mad:

Xplorer4x4
09-28-2005, 04:14 AM
Then you have something else interfering with it then. There's no way it can be off with the code Kirby fixed. I'm also running it on RC 3 and it is right on the dot. ;)

:ermm: Well I guess I will have to disable some hacks to test it again. I did do come slight modification to remove the <BR> tags because i wanted to place this in a diffrent section of the member profile. When I placed it above the last activity code it would break the labels and time/date into diffrent lines. It has been working fine up untill a few days ago.

Boofo
09-28-2005, 04:20 AM
Ahh, so you did something to it in editing it. ;)

Xplorer4x4
09-28-2005, 05:14 AM
Yes I did! :p But the thing is it was working fine after the edit, not sure how long though. Then i noticed it was off the other day.

Here is the section of my member info template:
<td><img src="$userinfo[avatarurl]" $userinfo[avatarsize] alt="<phrase 1="$userinfo[username]">$vbphrase[xs_avatar]</phrase>" border="0" style="border:1px solid $stylevar[tborder_bgcolor]; border-top:none" /></td>
<else />
<td>&nbsp;</td>
</if>
<td class="smallfont" valign="bottom" align="$stylevar[right]">
<!-- Local Date and Time in Profile -->$vbphrase[bf2_local_time]:$userinfo[localtime]<br/>$vbphrase[bf2_local_date]: $userinfo[localdate]
<!-- Local Date and Time in Profile -->
<if condition="$show['lastactivity']">
<div>$vbphrase[last_activity]: $userinfo[lastactivitydate] <span class="time">$userinfo[lastactivitytime]</span>&nbsp;</div>
</if>
<if condition="$show['currentlocation']">
<div>$userinfo[action] $userinfo[where]<if condition="$show['detailedtime']"> - <else /> @ </if> $userinfo[time]&nbsp;</div>
</if>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- / main info - avatar, profilepic etc. -->


I assume removing the line breaks is causing a problem?

Boofo
09-28-2005, 05:28 AM
I have no idea what is going on. It has to be something you either added or chnanged from when it was working fine before. Just backtrack to that time and leave it at that and you should be ok.

Xplorer4x4
09-29-2005, 03:50 PM
I will test some hacks and see if there casuing a problem.

<!-- Local Date and Time in Profile -->$vbphrase[bf2_local_time]:$userinfo[localtime]<br/>$vbphrase[bf2_local_date]: $userinfo[localdate]
<!-- Local Date and Time in Profile -->

But there should be no problem with this cide right?

dieselpowered
09-29-2005, 04:17 PM
Well done, I like it!!

**clicks install**

Forgive me for a second, however, was it intentially done so that if someone does not have their b-day filled out that this does not show on MEMBERINFO?

Boofo
09-30-2005, 01:28 AM
Well done, I like it!!

**clicks install**

Forgive me for a second, however, was it intentially done so that if someone does not have their b-day filled out that this does not show on MEMBERINFO?

The b-day has nothing to do with this mod. You must have included it in an if statement for the b-day by accident. ;)

Xplorer4x4
10-15-2005, 05:14 AM
My code worked fine. Just reinstaled the plug in.

Jacqueline
12-04-2005, 12:19 PM
The b-day has nothing to do with this mod. You must have included it in an if statement for the b-day by accident. ;)

I wound up doing this too when I followed the instructions in 3.5.1. The birthday phrase it said to look for wasn't there exactly, but one close to it was. It said to look for this:
<if condition="$userinfo['birthday']">, which did not exist.
I found this instead.
<if condition="$show['birthday']">
This wound up putting it inside the If statement so that if there was additional userinfo, it showed, but if not, it did not show and just put an N/A in the field.

To fix it, I looked for this code:
<else />
<em>$vbphrase[n_a]</em>
</if>
</div>

Then put this code after it:
<!-- Begin Local Date and Time in Profile -->
<span class="fieldset">
<table>
<tr>
<td><strong>$vbphrase[bf2_local_time]</strong>:<br />$userinfo[localtime]</td>
</tr>
<tr>
<td><strong>$vbphrase[bf2_local_date]</strong>:<br />$userinfo[localdate]</td>
</tr>
</table>
</span>
<!-- End Local Date and Time in Profile -->

Jacqueline
12-05-2005, 09:38 PM
My members are absolutely raving over this mod. They love it! Thank you very much.

Boofo
12-05-2005, 10:32 PM
My members are absolutely raving over this mod. They love it! Thank you very much.

Thank for the kind words. It's a must have on my site, also. ;)

Bubble #5
12-05-2005, 11:20 PM
The instructions say:

In MEMBERINFO template:

Find:
<if condition="$userinfo['birthday']">

We don't have that condition listed :( all we show is:

<if condition="$show['birthday']">

Is that the same thing, or will it work? :ermm:

Boofo
12-05-2005, 11:24 PM
The instructions say:



We don't have that condition listed :( all we show is:



Is that the same thing, or will it work? :ermm:

Try it and see. ;)

It should work fine.

ManagerJosh
12-05-2005, 11:45 PM
Long Live Chen's Hack! :D

Bubble #5
12-06-2005, 12:00 AM
It should work fine.
Umm... nope :( Nothing is showing up in profile.

Boofo
12-06-2005, 12:06 AM
Umm... nope :( Nothing is showing up in profile.

Did you import the product file and make sure it is enabled?

Try another spot in there and see if that works. You can put it anywhere you like. ;)

Boofo
12-06-2005, 12:07 AM
Long Live Chen's Hack! :D

Exactly! ;)

Bubble #5
12-06-2005, 12:17 AM
Try another spot in there and see if that works.
BINGO! :D

Thanks Boofo! Big fan of your work :)

Boofo
12-06-2005, 12:18 AM
BINGO! :D

Thanks Boofo! Big fan of your work :)
Glad you got it working. Enjoy! ;)

Jacqueline
12-07-2005, 08:33 AM
BINGO! :D

Thanks Boofo! Big fan of your work :)

Bubble,
Look at post #60 in this thread. I showed the problem with the birthday and the full fix. It has exactly where to put the code and the slight modification to it to make it work there.

The problem with using it next to the current birthday statement is because it is inside an If statement, and if the user has no additional info, it doesn't show up.

dieselpowered
12-07-2005, 03:19 PM
Boofo, just wanted to let you know that this works with 3.5.2, incase you wanted to change the version at the top of the thread :)

Bubble #5
12-07-2005, 05:07 PM
Bubble, Look at post #60 in this thread.
Thanks Elleth, (beautiful name by the way ) :nervous:

We jazed the code up a bit to make it look nicer. It didn't make much sense to have it say "Additional Information - N/A" and then list information like the time and date, so we fixed it like this:

Find:
<else />
<em>$vbphrase[n_a]</em>
</if>
</div>


...and replace it with:

<phrase 1="$userinfo[username]">$vbphrase[time_date_intro]</phrase>


Now go to Phrase Manager > Add New Phrase.

Under Varname add:

time_date_intro

Under Text add:

Local time and date for {1}:

Click Save.


We also changed the bold part around to match the rest of the profile. Simply remove the bold from the headings and add it to the output of each command and that's it. You can also add fieldset to the code if you want (we didn't because we are designing an entirely new profile section for our board) but otherwise fieldset will blend the old style in closer. Check it out, it looks much better now and is personalized. Enjoy :nervous:

Boofo
12-07-2005, 05:49 PM
Maybe a pic to show us how it looks now? ;)

Bubble #5
12-07-2005, 06:56 PM
Maybe a pic to show us how it looks now? ;)
LOL. Say pppppppplease :nervous:

This screenshot is how the code above will make it look. I will jazz it up more later with fieldsets that have a mouseover effect and other goodies. I'll post more about this as time permits :up:

BabyNameAddict
03-09-2006, 01:15 AM
Love it, love it, love it!!

jacx
03-14-2006, 05:51 PM
thanks u kindly

JaniU
03-19-2006, 06:01 PM
Is there a way.. well of course there is, but could someone do it.. :)
It would be cool to show the local time the post is made in each post!

(Actually I was kinda hoping to get that and didn't read everything through so well but of course after installing this I realized it shows always the users current local time/date...)

Stop
05-11-2006, 09:03 AM
Works on 3.5.4 :banana:
I'm really a big fan of your hacks, Boofo. But in In MEMBERINFO template I add it above this and it works fine.

<if condition="$show['birthday']">


Thanks a lot Sir.

Boofo
05-11-2006, 09:21 AM
Works on 3.5.4 :banana:
I'm really a big fan of your hacks, Boofo. But in In MEMBERINFO template I add it above this and it works fine.

<if condition="$show['birthday']">


Thanks a lot Sir.

Thank you for the kind words, sir. ;)

You can put it wherever it looks good to you in the profile. It should work almost anywhere in there. I just added the instructions of where I had mine. ;)

I will make a suggestion, though. I would add the local date in the postbit along with the time. The reason is that sometimes you will get someone that is a day behind you in time or a day ahead, depending on what time of the day it is. It can be confusing to members trying to figure out what day it would be for that person and if they were ahead or behind in time. Just a suggestion. ;)

Boofo
05-11-2006, 09:25 AM
Is there a way.. well of course there is, but could someone do it.. :)
It would be cool to show the local time the post is made in each post!

(Actually I was kinda hoping to get that and didn't read everything through so well but of course after installing this I realized it shows always the users current local time/date...)

The only problem with doing that would be if someone was 14 hours ahead of you or 14 hours behind you, it could get real confusing, plus it would throw everything off time-wise. ;)

Stop
05-11-2006, 09:50 AM
I will make a suggestion, though. I would add the local date in the postbit along with the time. The reason is that sometimes you will get someone that is a day behind you in time or a day ahead, depending on what time of the day it is. It can be confusing to members trying to figure out what day it would be for that person and if they were ahead or behind in time. Just a suggestion. ;)

Right what you say. I omitted the L.D. coz all most all the members I'm having on my board are from the Middle East and only very few ones from America and Canada. When we grow up, I will add it back though.

Thanks for your concern. Keep the high spirit. ;)

Boofo
05-11-2006, 10:29 AM
Right what you say. I omitted the L.D. coz all most all the members I'm having on my board are from the Middle East and only very few ones from America and Canada. When we grow up, I will add it back though.

Thanks for your concern. Keep the high spirit. ;)

It was just an observation. By all means, do it the way that you want to do it. What works for me doesn't necessarily work for everyone else. ;)

antialiasis
05-11-2006, 12:00 PM
In order to make this show up for users who have no other additional info (at least at the location you said to put it at), it is necessary to add $show['extrainfo'] = true; to the member_complete plugin.

Sorry if somebody mentioned this before, but I figured you'd have fixed it if somebody had, and was too lazy to check through the whole thread.

But nice hack, nonetheless.

Boofo
05-12-2006, 02:03 AM
In order to make this show up for users who have no other additional info (at least at the location you said to put it at), it is necessary to add $show['extrainfo'] = true; to the member_complete plugin.

Sorry if somebody mentioned this before, but I figured you'd have fixed it if somebody had, and was too lazy to check through the whole thread.

But nice hack, nonetheless.

Well, I've never run into anyone that didn't have at least one thing showing there so yes, you are right in that respect. ;)

SHalliday
05-23-2006, 07:25 PM
Clicked Install

Very nice .... Thank you!

Parker Clack
06-05-2006, 05:20 AM
Boofo:

Works great in 3.5.4.

Thanks for the mod.

Parker

peterska2
06-12-2006, 08:53 PM
works on 3.6 :)

A_N_K_A_R_A
06-30-2006, 08:44 AM
very nice thanks...

project-Buckfas
08-13-2006, 10:33 AM
Where do I put the code in postbit legacy if I want this to show between "posts" and "location"

project-Buckfas
08-14-2006, 05:04 PM
Anyone?

peterska2
08-14-2006, 08:01 PM
put it before<div>$vbphrase[posts]: $post[posts]</div>

project-Buckfas
08-15-2006, 05:16 PM
Thanks Kerry Anne

Bubble #5
01-26-2007, 08:02 PM
works on 3.6 :)

Thanks! That's what I was looking for :D

rjmjr69
03-24-2007, 09:45 AM
Nice works great in 3.6.5 Thank you

Is there a way to change the color of the text in the postbit?

obmob
05-29-2007, 10:57 PM
Nice works great in 3.6.5 Thank you

Is there a way to change the color of the text in the postbit?You can apply a css class to the code. ;)

rjmjr69
05-29-2007, 11:05 PM
You can apply a css class to the code. ;)


I could If I knew what the heck that is....lmao :D

FelixFlow
09-11-2007, 07:38 AM
i installled this, and used the modified code as in post #60 as well

awesome mod, thanks to all!!

:)

Trickster303
11-04-2007, 10:41 PM
Thanks, works fine for me!!!

Boofo
01-27-2008, 12:55 PM
Has anyone gotten this to work in the new profile for 3.7 yet?

mandy71480
03-30-2008, 01:19 AM
Worked fine in 3.6.8 PL2- thanks so much!

Boofo
03-30-2008, 04:54 AM
When you upgraded to 3.7 there is a version for that, too. And you are very welcome. ;)