Log in

View Full Version : Last Seen Online in Postbit vB 3.8.1


Dave Hybrid
03-11-2009, 09:33 AM
Hi all,

So I want to add last seen online to the postbit, there are no new mods for this and old ones do not seem to work.

I know where I add the code manually but if I copy paste the same code used in the member profile it shows the title but not the date, as if the $ command is only good for the member page.

Any ideas what I would use?

BigJohnny
03-11-2009, 10:33 AM
its probably going to be either a $userinfo or a $prepared var, it would only be $prepared if vB has an existing variable for last seen online.

I had a problem with signatures in my memberinfo template, when I used $post[signature] it would return the sig, but if there was a sig pic it would only show the bbcode tags for sig pics.

I found out that memberinfo already had a sig part, so I used $prepared[signature] and it displayed the sig with pics, because vbulletin has already "prepared" the signature.

Dave Hybrid
03-11-2009, 10:51 AM
Neither work.

Lynne
03-11-2009, 02:06 PM
As I posted over on vb.com, you'll need to use $post or $userinfo. However, the code you posted over on vb.com isn't going to work as is. You have a bunch of variables in it that aren't defined for use in the postbit. You will have to simplify it quite a bit.


edit: Someone posted this in another thread. It may work for you:
<div>$vbphrase[last_seen_online]: $post[lastseen_date] $post[lastseen_time]</div>

You may have to create that phrase or just use text. And, I'm not sure if those are actual working variables or ones he created using a plugin. Try substituting variables that you were going to use in there.

Dave Hybrid
03-11-2009, 02:15 PM
Yeah, doesn't work thanks anyway.

Lynne
03-11-2009, 02:33 PM
You know, simply saying "doesn't work" isn't going to help us to help you. You need to post the code you are using with a couple of lines before and after your code if you want us to help you debug it. Also, post your plugin code (and location) so we can see how you are getting these variables.

Dave Hybrid
03-11-2009, 02:42 PM
I'm just placeing it in postbit under join date.

<div>$vbphrase[last_seen_online]: $post[lastseen_date] $post[lastseen_time]</div>

The : shows but the data doesn't so the $varibles are not right, otherwise code is fine.

Likewise saying 'just create a plugin is not helpful. What does one put in this plugin?

Lynne
03-11-2009, 02:57 PM
I thought you were trying other variable names at first? Not $post[lastseen_date]. I thought you had some names from the memberinfo template that you were trying ($post[lastactivitydate] or $post[lastactivitytime]?). I never said to just create a plugin - I don't know if you need one. I did say that if you do have a plugin, you need to post your code for us to see.

And I know that phrase is not available because I checked - which is why I said you would have to create it or use text.

Dave Hybrid
03-11-2009, 03:05 PM
<div>$vbphrase[last_seen_online]: $userinfo[lastactivitydate] $userinfo[lastactivitytime]</div>

Yeah, these are the other ones, i posted them over at vb.com, they do not work either. The phrase is not a problem, i can just use text. It's the data pulled that is important.

Lynne
03-11-2009, 03:13 PM
Then it sounds like you will need to write a plugin to define the variables you want to use. You'll probably want to use one of the postbit_* hook locations. You should look in the code to see what variables are available at each location. If you have a date available, then you should be able to format it using something like (this is taken from a mod I wrote and you'll have to change it a little bit, I'm sure):
$user['date'] = vbdate($this->registry->options['dateformat'],$user['dateline']);
$user['time'] = vbdate($this->registry->options['timeformat'], $user['dateline']);
$userdateline = $user['date'] .' '. $user['time'];

And then you would use $userdateline in the template. As I said though, take a look in the code around the hook location to see what the names of the variables are that you would use in your plugin.

Dave Hybrid
03-11-2009, 03:31 PM
I wish I knew where to start with the php bit.

mcrider
03-12-2009, 02:02 PM
I am using this on 3.8.1

https://vborg.vbsupport.ru/showthread.php?t=123366

Dave Hybrid
03-12-2009, 02:18 PM
Thank you very much, that's perfect. +rep.