Log in

View Full Version : Miscellaneous Hacks - Poster's local time and date in postbit and profile


Boofo
02-02-2008, 10:00 PM
Poster's local time and date in postbit and profile for vBulletin 3.7.0 beta 4
Version 1.0.1
(By Boofo)

What does this product do?
This product will add the local time and date of posters 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.

Note: This will also show the correct time and date of the poster to guests. You do not have to be logged in to know what time it is in someone else's world. ;)

Credits:
Thanks goes out to KirbyDE for pointing me in the right direction for the profile time and helping to verify the original code. And thanks goes out to Chen Avinadav for making the first local time hack for vB2 and allowing me to release it for vB3, vB3.5 and now vB3.7.0 beta 4. A special thanks goes out to Dismounted, a distinguished member of the vb.org Staff, for catching my newbie mistake of not checking for new hook placements.

Version Information:
Version 1.0.1 --Initial release

Installation overview:
Templates to edit: (3)
--postbit
--postbit_legacy
--memberinfo_block_ministats
Products to install: (1)
--product-local_time_bh.xml

Installation Intructions:
Import the product in your Admin CP, do the template edits and you're all set!

NOTE: If you do not click install, you do not need support.

asj
02-04-2008, 12:07 AM
Composite simple wonderful

Boofo
02-04-2008, 12:37 AM
Don't forget the install button. ;)

And thank you.

KURTZ
02-04-2008, 09:41 AM
i hate the template edits Boofo ... :)

anyway you're a great coder ... keep up the great job dude ...

therogueforums
02-05-2008, 03:35 AM
Awesome idea! ...however...

I did the template edits, exactly how the install text instructs... and the postbit is epically screwed up now. Had to revert and uninstall.

Boofo
02-05-2008, 03:44 AM
Well, the template edit for the postbit is the one I use. The postbit_legacy was a best guess for me as I don't use that one. As long as you have the two phrases and the 2 variables you can put it anywhere.

$vbphrase[bf2_local_time]: $post[localtime]
$vbphrase[bf2_local_date]: $post[localdate]

therogueforums
02-05-2008, 03:52 AM
The postbit template is the one I was referring to. No worries, though- decided the info that this mod puts in the user profile is enough. Also, I don't like adding too much to the postbit, so this actually works out well.

Again, WONDERFUL idea for boards with lots of members across the globe- time xones are always an issue when trying to plan something. This will help people plan a bit better, IMO.

Boofo
02-05-2008, 03:55 AM
You want the posbit like I have mine? All neatly lined up like in the pic in the first post. It even does a nice break for the location if the location is too long, while lining things up on the left evenly.

I also added the Timezone Image in Profile hack that shows a map and the date/time in the profile. ;)

Mike-D
02-06-2008, 05:59 PM
Awesome idea! ...however...

I did the template edits, exactly how the install text instructs... and the postbit is epically screwed up now. Had to revert and uninstall.Time to get TMS. Those things would never happen in using TMS ;)

Boofo
02-06-2008, 06:15 PM
What is TMS?

Mike-D
02-06-2008, 07:49 PM
What is TMS?Don't say you don't know the well known Template Modification System (https://vborg.vbsupport.ru/showthread.php?t=152931) ? It's one of the best hacks ever and I use it since a long time. With using it I've never gotten any problems in Template changes. Really too bad that this hack never got the MOTM status :( It's simply the best. So I've installed your hack and created the Template modifications and needed less than 1 minute ;)

BTW: Your hack is really great and I installed it. Thank you very much for this, Bob :) -Mike

Boofo
02-06-2008, 08:29 PM
I've never used that. I went straight form 3.5.4 to the latest version, doing a fresh install. I've been out of the loop way too long, it seems. First, will that work on 3.7.0 beta 4? And second, being Kirby write that, I'm hesitant to use it as I'm not sure he knows that much about coding for vb, then it must be good. ;)

And, Mike, do I know you from the old days here?

Mike-D
02-06-2008, 09:40 PM
IFirst, will that work on 3.7.0 beta 4? TMS? Yep it does :) Admittedly I needed really a long time to understand what TMS does and where all the power is. At the first sight it's really complex to understand it. And I needed really some months to understand exactly how it works. Once you have it installed you'll never miss it an also you can't live without it ;)

Bob: I've created 2 TMS Files for you! You can choose whatever you'd like to do. The first one "Product-local_time_bh-TMS" contains the additional TMS Code and its separate Template Codes within your hack. When you have TMS installed all you have to do is to import your Product. That's all :)

The second one "TMS_Code_Local_Time" is the small Template Code itself and will imported under TMS itself.

And, Mike, do I know you from the old days here?Dunno what you mean about "old days", because I'm a member since '06 in that forum. Unless you know me from my US friends at the Acura Legend Forum (http://www.acura-legend.com/vbulletin/) in the USA. Then you're right because I'm a member since 6 years over there ;)

Boofo
02-06-2008, 10:00 PM
So this will edit the template automatically when you insert the xml? How does it know which template edits go with which hack? This looks like a dream come true on upgrades for template changes. What's the learning curve on it?

I don't know the Acura Legend Forum, so I must have been wrong about knowing you. Better for you, anyway, as knowing me doesn't bring a lot of good luck to anyone. Ask around, you'll see. ;)

Mike-D
02-07-2008, 10:25 AM
So this will edit the template automatically when you insert the xml?Exactly that's the way of TMS!

How does it know which template edits go with which hack?Till today I've never seen a hack, which won't work with TMS!!! For example: I have installed really complex hacks and most of them are Statistic hacks and some special Database hacks. And I've never seen that TMS won't work. All you have to know is, that TMS does not work with MySQL 4.0! But I recommend you to read the whole TMS thread. Just because there are lots of infos.

This looks like a dream come true on upgrades for template changes.You hit the nail on the head, Bob :) This does not looks like a dream: It's really a dream for all user who are not able or willing (what I can understand) to re-edit all her Template changes after any vB Upgrades. Whenever you have made Template changes in the course of time without TMS, it's always a pain to re-edit all Template changes after vB Upgrades. Not in doing with TMS! TMS work always transparent on each Template you have changed!!! And this is exactly the way.

What's the learning curve on it?The learning curve? Well for the first time it's a lil bit complex to understand how TMS works. But it's kinda different how each people does understand how it works. For example: I'm a person who thinks always too complex whereby others always think easy. Probably you're such a person. Then it should no problem for you. Give it a try and you'll never live without it. That's a promise ;)

Better for you, anyway, as knowing me doesn't bring a lot of good luck to anyone. Ask around, you'll see. ;)Na I don't think so, because you are a great coder in my eyes. I've read and studied many hacks from you and your ideas are always very instructive and great. So please don't have a false modesty, Bob :)


Sorry for being in the wrong thread. I do know that this do not belong where it belongs to, but I'm strongly convinced about the TMS hack. So I will try to do my best that this hack deserve what it deserves: MOTM

Boofo
02-07-2008, 12:34 PM
I will give that a try. Sounds good. ;)

Mike-D
02-07-2008, 06:04 PM
I will give that a try. Sounds good. ;)You'll never regret it, Bob. Trust me ;)

Bounce
02-10-2008, 07:03 PM
Another one of yours installed :D

Works great,as a uk site we have quite a few US based users and this is handy in knowing what time there at..

Thanks :up:

Boofo
02-10-2008, 07:48 PM
I have to admit, this is my favorite of all my hacks. It saves me trying to bother someone who might be in bed. ;)

Guest210212002
02-16-2008, 01:16 PM
/me clicks install

OrionsMom
02-19-2008, 08:43 PM
Very kewl :) INSTALLED :)

Pamela
03-28-2008, 08:01 AM
*clicks install*

Awesome! Thanks!!! :)

Jafo232
05-23-2008, 12:38 PM
I am using this on a board with some restrictions on mods, mostly being that we want to limit physical edits of the templates and use template hooks whenever possible. We only wanted this product for the postbit, so if you want to make this work without the template edit of the postbit legacy here is the code you add in the plugin titled "Local Date/Time in Postbit" right at the end of the plugin:

$template_hook[postbit_userinfo_right_after_posts] = "<if condition=\"$post[userid]\">
<div>$vbphrase[bf2_local_time]: $post[localtime]</div>
<div>$vbphrase[bf2_local_date]: $post[localdate]</div>
</if>";

Boofo
05-23-2008, 01:02 PM
Thank you, sir. ;)

MeMySelfNi
05-24-2008, 02:58 AM
It made my postbit look all wacky, so i had to uninstall this~

Boofo
05-24-2008, 03:06 AM
Then you installed it wrong.

TimberFloorAu
05-24-2008, 03:57 AM
Timber clicks :Installed

Hmm.. It dont work lol

Is it because we have 3.7.gold or perhaps php5

Any suggestions.

And yep, installed to the letter of the law :)

MeMySelfNi
05-24-2008, 07:30 AM
I am using this on a board with some restrictions on mods, mostly being that we want to limit physical edits of the templates and use template hooks whenever possible. We only wanted this product for the postbit, so if you want to make this work without the template edit of the postbit legacy here is the code you add in the plugin titled "Local Date/Time in Postbit" right at the end of the plugin:

$template_hook[postbit_userinfo_right_after_posts] = "<if condition=\"$post[userid]\">
<div>$vbphrase[bf2_local_time]: $post[localtime]</div>
<div>$vbphrase[bf2_local_date]: $post[localdate]</div>
</if>";


Thanks for this. Now its all lined up. >>>installed<<<

Boofo
05-24-2008, 04:52 PM
Timber clicks :Installed

Hmm.. It dont work lol

Is it because we have 3.7.gold or perhaps php5

Any suggestions.

And yep, installed to the letter of the law :)

Yes, it does work. What is it not doing for you?

TimberFloorAu
05-24-2008, 07:36 PM
Yes, it does work. What is it not doing for you?

Not displaying anything.

However, we migrated server over this weekend, and I have a sneaky feeling, we may have been viewing admin on old server.

Will go check now ( my humblest apologies if thats the simple error )

WIll check back.


Ozzy

Boofo
05-24-2008, 07:41 PM
LOL Most likely it is something simple like that. Let me know.

TimberFloorAu
05-24-2008, 07:44 PM
Boofo.

My sincerest apologies.

As most foum owners, we have two browsers always open, i use IE and FF

FF had dns refreshed for new server, IE didnt !

Guess which one, I was logged in on for admincp !!

lol

It works a bloody charm mate !! Cheers

Ozzy

Boofo
05-24-2008, 07:46 PM
Great! Enjoy! ;)

shlomot
06-15-2008, 01:16 PM
Dear Boofo, I imported the XML with the notion that I'll be able to use the variable $userinfo[localdate] for date calculations in a PHP module. However, it returns null.

Can you help me please to figure out how to derive user's local date?

Boofo
06-15-2008, 01:26 PM
Where are you trying to use it?

shlomot
06-15-2008, 01:52 PM
In a PHP module on a CMPS page. I need it in order to draw the member's biorhythm chart that is based on their birth of date and their current date.

Where are you trying to use it?

Boofo
06-15-2008, 02:27 PM
This hack is only going to work in the postbit and profile. You could use the date("m-d-y") to get today, but it wouldn't be according to their timezone. It would be according to the server's timezone.

BigDog56
06-15-2008, 02:54 PM
Made mine look wacky too. It put everything on the left hand side. (Using postbit) Must be conflicting with another mod. (Used TMS). Let me try adding the temp. mods manully and see if that makes a difference.

BigDog56
06-15-2008, 03:05 PM
Even tried it manually, still put everything over to the left hand side.

shlomot
06-15-2008, 03:29 PM
Thank you, Boofo, very much for trying. Please let me know should something comes to your creative mind. I can even pay for it.

This hack is only going to work in the postbit and profile. You could use the date("m-d-y") to get today, but it wouldn't be according to their timezone. It would be according to the server's timezone.

Boofo
06-15-2008, 03:43 PM
Even tried it manually, still put everything over to the left hand side.

Just add the date and time lines separately and you should be OK.

Thank you, Boofo, very much for trying. Please let me know should something comes to your creative mind. I can even pay for it.

Donations are always welcomed. I will see what I can come up with for you. ;)

BigDog56
06-15-2008, 05:26 PM
Just add the date and time lines separately and you should be OK.



Donations are always welcomed. I will see what I can come up with for you. ;)

Let me try that.

BigDog56
06-15-2008, 05:44 PM
Ok, what I did was just add this above as directed to the postbit. (Using TMS)

<if condition="$post[userid]">$vbphrase[bf2_local_time]: $post[localtime]</div></if>
<if condition="$post[userid]">$vbphrase[bf2_local_date]: $post[localdate]</div></if>

I left the 2nd edit as is and it seems to work just fine now. thank you!