View Full Version : Profile Enhancements - Date & Time of Profile Visitor
Lynne
01-05-2009, 10:00 PM
A simple mod to show the date and time of the profile visitor when you hover your cursor over their username in Recent Visitors in member.php.
1. Go to your Admin CP > Plugins & Products > Download / Upload Plugins > Upload the sml file profile_visitor_datetime.xml
2. Change the template "memberinfo_visitorbit" from:
<li class="smallfont"><a href="member.php?$session[sessionurl]u=$user[userid]">$user[musername]</a>$user[invisiblemark]$user[buddymark] </li> To:
<li class="smallfont"><a href="member.php?$session[sessionurl]u=$user[userid]" title="$userdateline">$user[musername]</a>$user[invisiblemark]$user[buddymark] </li> Save the template.
3. Open the file includes/class_profileblock.php and find the following line around line 1159:
eval('$visitorbits .= "' . fetch_template('memberinfo_visitorbit') . '";');
Add above it:
$user['date'] = vbdate($this->registry->options['dateformat'],$user['dateline']);
$user['time'] = vbdate($this->registry->options['timeformat'], $user['dateline']);
$userdateline = $user['date'] .' '. $user['time']; Save and upload the file.
This was written for and tested on my 3.8.0 RC1 board.
Bounce
01-06-2009, 08:58 PM
ahhh excellent lynne :up:
Screenshot attached as someone is bound to ask for one :eek::D
Lynne
01-06-2009, 09:13 PM
Thanks for the screen shot! I meant to do one and then forgot about it.
goxy63
01-06-2009, 09:14 PM
Pitty Iam second :(
Nominated, rated, installed
Thanks Lynne
Here is a HUG from me :eek:
:D
g0dfather1984
01-06-2009, 09:43 PM
Thank you, Lynne.
SEOvB
01-06-2009, 09:46 PM
Nice work lynne!
Should be default!
Ch13f
01-07-2009, 02:04 PM
thanks lynne nice
glorify
01-07-2009, 03:49 PM
Usergroup permissions or do we have to add conditionals?
Lynne
01-07-2009, 11:30 PM
You could just add a condition either around the php code (added in step 3) or the template code (added in step 2). Either will work.
azher
01-16-2009, 06:44 AM
great mod. does anyone know of a way to make the profile visitors show up in the order of when they visited rather than in alphabetical order?
Magnumutz
01-16-2009, 09:06 AM
Sweet but just hate file edits...
Lynne
01-16-2009, 03:10 PM
great mod. does anyone know of a way to make the profile visitors show up in the order of when they visited rather than in alphabetical order?
Comment out the line in class_profileblock.php that sorts them:
// uksort($visitors, 'strnatcasecmp');
Sweet but just hate file edits...
So do I, but unfortunately I couldn't find a way around it.
algor65
01-18-2009, 10:04 PM
nice item, installed and rated as MOTM
TimberFloorAu
01-18-2009, 10:08 PM
Good Work Lynne :up:
goxy63
01-22-2009, 03:00 AM
Lynne
Regarding to 'azhers' post, and your reply....
quote:
'great mod. does anyone know of a way to make the profile visitors show up in the order of when they visited rather than in alphabetical order?'
In includes/class_profileblock.php
I found mentioned line
// uksort($visitors, 'strnatcasecmp');
But what to change here to show up vistitors in mentioned order ?
Lynne
01-22-2009, 04:04 AM
Just comment out that line like I showed (put the // in front of it).
azher
01-25-2009, 10:13 PM
Just comment out that line like I showed (put the // in front of it).
yup. what she said. thanks, lynne. works like a charm. :)
SuperTaz
02-06-2009, 03:26 PM
Thank you, Lynne. Installed.
goxy63
02-09-2009, 07:57 PM
Thanks Lynne, edited that long time ago :D
Now just upgraded to Vb 3.8.1 and had to change stuff again in includes/class_profileblock.php...works just great
What I wanted to ask can this work out for blogs just the same !?
Any pointers !?
Lynne
02-09-2009, 08:32 PM
The idea would be the same for the blog, however since I don't have the blog add-on, I can't try it out.
princeedward
09-14-2009, 10:53 AM
nice and useful...thanks for this Lynne ;)
Nordinho
02-09-2010, 09:09 PM
Very nice, ty!
goxy63
03-02-2010, 05:58 PM
Will install VB4 soon, does anyone know is this option default there?
My users love this option :)
princeedward
03-06-2010, 07:41 PM
Hi Lynne....is this goin to make it work with vB 4.0.2?
hope so...
best regards
;)
Lynne
03-06-2010, 08:15 PM
I don't see why it couldn't work in 4.0.2 except the template edit would be different for 4.0.
princeedward
03-07-2010, 08:42 AM
thanks Lynne...tried to find the line at includes/class_profileblock.php can't find it...seems to be that they change it or...
would you be so kind (as always) :p please to re code this at your spare time...my members are keep bugging me on this one
thanks and best regards
;)
princeedward
03-10-2010, 01:53 AM
Hi Lynne tried to figure out and make this work but no luck at all...
as i said can't find this and can you please help me on this...
eval('$visitorbits .= "' . fetch_template('memberinfo_visitorbit') . '";');
to includes/class_profileblock.php
but i added it instead here to think and hope the right place is...but...
$visitorbits = '';
foreach ($visitors AS $user)
{
fetch_musername($user);
$user['invisiblemark'] = !$user['visible'] ? '*' : '';
$user['buddymark'] = in_array($user['userid'], $buddylist) ? '+' : '';
$user['date'] = vbdate($this->registry->options['dateformat'],$user['dateline']);
$user['time'] = vbdate($this->registry->options['timeformat'], $user['dateline']);
$userdateline = $user['date'] .' '. $user['time'];
$templater = vB_Template::create('memberinfo_visitorbit');
$templater->register('user', $user);
$visitorbits .= $templater->render();
}
Upload the plugins without touching it i guess its look okay..hope so...:p
<plugins>
<plugin active="1" executionorder="5" product="vbulletin">
<title><![CDATA[Get Recent Visitor Date & Time]]></title>
<hookname>member_profileblock_recentvisitors_query</hookname>
<phpcode><![CDATA[$hook_query_fields= ',profilevisitor.dateline';]]></phpcode>
</plugin>
</plugins>
and edit the template "memberinfo_visitorbit"
FROM:
<li> <a class="username" href="{vb:link member,{vb:raw user}}">{vb:raw user.musername}</a>{vb:raw user.invisiblemark}{vb:raw user.buddymark}</li>
TO:
<li> <a class="username" href="{vb:link member,{vb:raw user}}" title="{vb:raw user.dateline}">{vb:raw user.musername}</a>{vb:raw user.invisiblemark}{vb:raw user.buddymark}</li>
but got anonym numbers only or say can't get it right...
any idea pls...what wrong?
thanks and best regards...
:o
Lynne
03-10-2010, 03:22 AM
Change this line:
$templater->register('user', $user);
To this:
$templater->register('user', $user);
$templater->register('userdateline', $userdateline);
And you also have the variable name wrong in the template, it should be title="{vb:raw userdateline}"
princeedward
03-10-2010, 12:10 PM
....hmmm...did it too that variable way but also didn't go well... but now i got it...million thanks once again Lynne for your never ending assistance or support here and there...just informed my members and they're really quite happy about this...
113820
so tested to my vb default skin and style skin...we can release it to vB4.0.0 Modification Section...i mean... YOU can release it now...if you have time enough :p
for the others to feel the heat of this wonderful mod of yours...
great...and much appreciated your assistance here once again...as always...
;)
Lynne
03-10-2010, 01:47 PM
what i mean...is YOU can release it now...if you have time enough :p
Unfortunately, time is something I don't have a lot of these days. You are welcome to release it in the vB4 section if you'd like.
princeedward
03-10-2010, 03:46 PM
Unfortunately, time is something I don't have a lot of these days. You are welcome to release it in the vB4 section if you'd like.okay..i will try my very best to make the best presentation of this mod....and of course with your name as original creator or developer of this mod...thanks for the permission to release it...i just want to share this also to others on the VB 4.00 Series Modification Section... and who knows they might need it too like i did and my members...
best regards...
hmm...where...or how do i start now?
:p
jscieza
12-30-2010, 02:20 AM
Hi Lynne,
If the last visit has been today, instead of displaying "12-30-2010, 14:20" it should display "Today, 14:20". If the last visit has been yesterday, instead of displaying "12-29-2010, 14:20" it should display "Yesterday, 14:20".
Could you please tell me how to do so?
Thank you,
Jonathan
Lynne
12-30-2010, 03:08 AM
Hi Lynne,
If the last visit has been today, instead of displaying "12-30-2010, 14:20" it should display "Today, 14:20". If the last visit has been yesterday, instead of displaying "12-29-2010, 14:20" it should display "Yesterday, 14:20".
Could you please tell me how to do so?
Thank you,
Jonathan
I believe you can just add a 3rd parameter to the vbdate function call and set it to true. You can read about the function in the API here - http://members.vbulletin.com/api/
jscieza
12-30-2010, 04:21 AM
Hi Lynne,
I'm not a programmer so I believe that I'm going to be unable to achieve that myself. If you get some free time soon hope you can give me a hand with this.
Thank you,
Jonathan
Lynne
12-30-2010, 05:05 PM
Hi Lynne,
I'm not a programmer so I believe that I'm going to be unable to achieve that myself. If you get some free time soon hope you can give me a hand with this.
Thank you,
Jonathan
As I said, you just add a third parameter of true to the date:
$user['date'] = vbdate($this->registry->options['dateformat'],$user['dateline'],true);
jscieza
12-30-2010, 10:04 PM
Hi Lynne,
Thanks for your reply! It's working fine in vB 3.8.5 :)
https://vborg.vbsupport.ru/
Just an important detail about my members are complaining. Everyone can see the date/time of the visit even in profiles of other members. I think that only the profile owner should be able to see that information.
How I can apply the conditional?
Thank you,
Jonathan
Lynne
12-30-2010, 11:00 PM
Hi Lynne,
Thanks for your reply! It's working fine in vB 3.8.5 :)
http://img63.imageshack.us/img63/7162/demoz.gif
Just an important detail about my members are complaining. Everyone can see the date/time of the visit even in profiles of other members. I think that only the profile owner should be able to see that information.
How I can apply the conditional?
Thank you,
Jonathan
Probably just put a condition about the php code you added to the file. Something like:
if ($vbulletin->userinfo['userid'] == $user['userid']) {
the date/time code
}
jscieza
12-30-2010, 11:23 PM
Thanks for your kind reply Lynne!
I applied the conditional and now I can't see the date/time even in my own profile :mad:
Lynne
12-31-2010, 03:14 AM
Thanks for your kind reply Lynne!
I applied the conditional and now I can't see the date/time even in my own profile :mad:
That's what I get for not taking my own advise and actually looking at the code in the file to determine the variable names!
if ($this->registry->userinfo['userid'] == $this->profile->userinfo['userid']) {
the date/time code
}
jscieza
12-31-2010, 03:47 AM
Just wanted to say thank you very much and Happy New Year! :up:
Lethaeus
01-01-2011, 08:34 AM
It's working fine in vB 3.8.6 PL1
Thanks
goxy63
01-08-2012, 11:05 AM
Did uninstall this one as for VB4, but installed again as mod for VB4 is not working :D
Simple edit which still works from here is:
includes/class_profileblock.php
// uksort($visitors, 'strnatcasecmp');
Would like to see date and time for VB4 but ..... even this is something for my users
goxy63
11-19-2012, 01:06 AM
Hope Lynne will find some free time to properly upgrade this one for VB4 as "princeedward" is not active here for a long time
My users dont peek that much to each other profiles since this mod is not working any more :[
Hello Lynne
will he crumb vb4.2+ a day. ?
thank you
Afandy
06-27-2014, 07:12 PM
very good work
goxy63
07-05-2014, 07:41 AM
I am sorry to bring this up again
anyone know how to make this work for vb4.2?
mokujin
07-05-2014, 07:49 AM
I am sorry to bring this up again
anyone know how to make this work for vb4.2?
It's here: https://vborg.vbsupport.ru/showthread.php?t=237963
goxy63
07-05-2014, 02:02 PM
It's here: https://vborg.vbsupport.ru/showthread.php?t=237963
that one not working mate, not since VB4.1.8
Check page 2 there
https://vborg.vbsupport.ru/showthread.php?t=237963&page=2
mokujin
07-05-2014, 02:47 PM
that one not working mate, not since VB4.1.8
Check page 2 there
https://vborg.vbsupport.ru/showthread.php?t=237963&page=2
Ok, check my post here https://vborg.vbsupport.ru/showthread.php?t=237963 again.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.