PDA

View Full Version : Miscellaneous Hacks - Postbit last date and time online


justicechick
07-11-2013, 10:00 PM
Postbit last date and time online


This is a simple mod that will place the last date and time online in the postbit.

Installation:

(1) Product To Upload Via:
Acp > Plugins & Products > Manage Products > Add/Import Product
(1) Simple Template To Edit Via:
Acp > Styles & Templates > postbit or postbit_legacy template

This works on 4.0.0 up to 4.2.1 (see attached pics of 4.2.1)

https://vborg.vbsupport.ru/external/2013/07/2.jpg?2Date and time in postbit

https://vborg.vbsupport.ru/external/2013/07/1.jpg?1 Date only in postbit


If you wish to only use the last date online in the postbit, without the time, use the XML titled LastdatePB

DemOnstar
07-12-2013, 11:26 AM
That did the trick.....

One question, is it possible to take out the time of day? Currently it reads

Last Online:1 Minute Ago @ 12:24

How do I change it to read Last Online:1 Minute Ago

Thanks for all you have done....

Edit: Nevermind, common sense really, I figured it out...

Cheers...

justicechick
07-12-2013, 01:37 PM
That did the trick.....

One question, is it possible to take out the time of day? Currently it reads

Last Online:1 Minute Ago @ 12:24

How do I change it to read Last Online:1 Minute Ago


Thanks for all you have done....

Edit: Nevermind, common sense really, I figured it out...

Cheers...

Great! Im glad it worked for you. :)

goxy63
07-12-2013, 04:16 PM
Any ideas how much this will slow down page load?

Also how to show just today, yesterday,... 100days ago?

Thank you

justicechick
07-12-2013, 04:37 PM
Any ideas how much this will slow down page load?

Also how to show just today, yesterday,... 100days ago?

Thank you

This is the first modification I have attempted, and its a pretty simple modification. Im sorry though that option isnt available with this modification. As far as slowing down the page load , there has been none noticed since the installation of this on my board.

justicechick
07-12-2013, 11:28 PM
For those that may have already installed this , have updated the zipfile. If you only want to use the last date online in the postbit please use the following code.

<!-- LAST ONLINE DATE START -->
<vb:if condition="$post['lastactivity']">
<dt>{vb:rawphrase last_online_activity}</dt><dd>{vb:raw post.lastactivity_date} </dd>
</vb:if>
<!-- / LAST ONLINE DATE END -->

DemOnstar
07-13-2013, 03:39 AM
Good job justicechick... Keep it up..

Jonm
07-16-2013, 02:37 PM
done...

Jonm
07-16-2013, 02:38 PM
But how can I remove the AM/PM part?

justicechick
07-20-2013, 11:39 PM
But how can I remove the AM/PM part?

Use the "LastdatePB" XML that is included in the zip

and use the following when modifying your template.

<!-- LAST ONLINE DATE START -->
<vb:if condition="$post['lastactivity']">
<dt>{vb:rawphrase last_online_activity}</dt><dd>{vb:raw post.lastactivity_date} </dd>
</vb:if>
<!-- / LAST ONLINE DATE END -->

Spangle
09-08-2013, 08:17 AM
Good little snippet this

Bubble #5
09-20-2013, 01:56 AM
Where do we shorten the phrase "minutes" to "min" ?

It is too long and breaking up. Thanks :)

Adam Wood
09-24-2013, 02:41 AM
The examples are in the legacy postbit. Anyone know if this works in the horizontal postbit?

justicechick
09-25-2013, 11:06 PM
Where do we shorten the phrase "minutes" to "min" ?

It is too long and breaking up. Thanks :)

This is something that is actually done within vbulletin itself and not it the plugin.

The steps to do so are as follows.

Admincp> Styles and Templetes> Replacement Variable > add new variable.

You would then select the style theme you want to change the variable in (change each one you use if you want consistency) Enter The text to be searched : Minutes
Enter Text to replace: Mins

You might also want to create one for the word Minute to replace Min

Submit and check your postbit then. Thanks

ozzy47
09-25-2013, 11:08 PM
Only problem with that is anywhere the word Minutes shows up, even in posts, it will be changed to Mins.

justicechick
09-25-2013, 11:20 PM
Only problem with that is anywhere the word Minutes shows up, even in posts, it will be changed to Mins.

True Ozzy....I meant to include that . Thanks for catching it.

ozzy47
09-25-2013, 11:30 PM
What you could do is create a new plugin.

Log into the ACP.
On the side menu expand "Products & Plugins"
Click on "Plugin Manager"
At the very bottom there is a link to "Add New Plugin"
On that page put in the following information-

Product: vBulletin (this should be default)
Title: Replace Minutes In Postbit
Hook: postbit_display_complete (from a drop-down list)
Execution Order: 5 (default value)
$vbulletin->templatecache['postbit_legacy'] = str_replace('Minutes','Mins',$vbulletin->templatecache['postbit_legacy']);I tested this with the word Minutes directly in the postbit, and it works, I did not test it with this mod, but it should work.

justicechick
09-26-2013, 12:42 AM
The examples are in the legacy postbit. Anyone know if this works in the horizontal postbit?

Here is the proof for horizontal postbit. https://vborg.vbsupport.ru/external/2013/09/19.png

Bubble #5
09-26-2013, 01:24 AM
Only problem with that is anywhere the word Minutes shows up, even in posts, it will be changed to Mins.

DOH!!! Now I've got to change it back :p

ozzy47
09-26-2013, 01:26 AM
DOH!!! Now I've got to change it back :p

You can use this method instead, https://vborg.vbsupport.ru/showpost.php?p=2448009&postcount=17

Bubble #5
09-26-2013, 01:37 AM
THANKS Ozzy, appreciate you taking the time to write that up :up:

ozzy47
09-26-2013, 01:39 AM
Not a problem, glad to help. :)

justicechick
09-27-2013, 06:50 AM
What you could do is create a new plugin.

Log into the ACP.
On the side menu expand "Products & Plugins"
Click on "Plugin Manager"
At the very bottom there is a link to "Add New Plugin"
On that page put in the following information-

Product: vBulletin (this should be default)
Title: Replace Minutes In Postbit
Hook: postbit_display_complete (from a drop-down list)
Execution Order: 5 (default value)
$vbulletin->templatecache['postbit_legacy'] = str_replace('Minutes','Mins',$vbulletin->templatecache['postbit_legacy']);I tested this with the word Minutes directly in the postbit, and it works, I did not test it with this mod, but it should work.

Thanks for taking the time to do that Ozzy. When I posted this I thought that I had warned users this was my first attempt at anything like this. :confused: Looking back now, I see that I seems to have not included that warning ....LOL

Thanks for looking out and lending a helping hand to us all... :up: Much appreciated!

I did check this out though with and without the code you supplied and I couldnt get it to change it. Im sure that I must be missing something.
https://vborg.vbsupport.ru/external/2013/09/15.png

ozzy47
09-27-2013, 09:23 AM
I dunno, as I said I did not try this with your mod, I will a bit later today when I get home from work and see what's going on.

Bubble #5
09-27-2013, 04:12 PM
I did check this out though with and without the code you supplied and I couldnt get it to change it. Im sure that I must be missing something.

I don't think it's on your end justicechick. It's not working here either. I eventually changed the phrase but not sure if that's the safe thing to do :cool: I'm sure ozzy will figure it out.

ozzy47
09-27-2013, 07:47 PM
Yeah I will look into it, it may be how the plugins run in order. I will look somtime either tonight, or tomorrow, got alot going on ATM.

justicechick
10-01-2013, 07:56 PM
I don't think it's on your end justicechick. It's not working here either. I eventually changed the phrase but not sure if that's the safe thing to do :cool: I'm sure ozzy will figure it out.

Thanks Bear lol...just making sure,