PDA

View Full Version : Idle? Member's name turns grey.


kpf1827
01-10-2012, 03:27 AM
Looking for some help building a hack. If a member does not move pages for 5 minutes, their username turns grey to symbolize that they are idle.

Disasterpiece
01-10-2012, 03:30 AM
there is a var called "last action" or something similar in the $vbulletin->session var which should be of use for your idea. Just check if the number is greater than $whatever_amount_of_seconds, then make the name grey, otherwise don't.

kpf1827
01-10-2012, 03:55 AM
Can you nudge me in the right direction.

I have experience with template variables (if conditionals), however I am lost when you mention $vbulletin->session var

Disasterpiece
01-10-2012, 04:52 AM
in template conditionals, you normally use regular php code, so... yeah. Something like this maybe:

<vb:if condition="$vbulletin->session['lastactivity'] > 3600"><span class="idle"><vb:else /><span class="normal"></vb:if>
Not tested, but should do the trick.
Replace 3600 with any amount in seconds after you want the user to be idle.

kpf1827
01-12-2012, 12:45 AM
Thanks, However I went into postbit_legacy and where it shows the username I added your code... with no effect

I've got to be missing something.

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

<a class="bigusername" href="member.php?$session[sessionurl]u=$post[userid]">$post[musername]</a>


<script type="text/javascript"> vbmenu_register("postmenu_$post[postid]", true); </script>
<else />
<if condition="$vbulletin->session['lastactivity'] > 2000"><b>$post[musername]</b><else /><i>$post[musername]</i></if>
</if>
</div>

kpf1827
01-14-2012, 01:23 AM
I am running Vbulletin 3.6.8 By the way, I think your above posts are referencing to vbulletin 4.0+

LifesGreatestGift
01-14-2012, 05:10 AM
kpf1827's code is for vB3 ;)