The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Conditional Based on lastactivity
I would like to display a box at the top of a user's profile if that user has either not logged in, or not updated their profile in the last 30 days (either one, but profile update preferred).
So I was thinking of making an IF conditional based on lastactivity... does anyone know how I would go about this? |
#2
|
||||
|
||||
there is a hack that shows when a user was last on in the postbit. I would imagine that the code used to add to the posbit would work in the profile.
https://vborg.vbsupport.ru/showthread.php?t=123366 but this hack recognizes visits as activity, not just posts, so if you want it to be registering when they posted last, the hack might need some customization. |
#3
|
|||
|
|||
Thanks very much, Ravyn! I'll give that a try.
Erm.... what would be the correct formating of the conditional? I'm not sure how to use dates. Is there a standard "30 days ago" or "1 week from now" kind of thing? And would it be as easy as something like $userinfo[lastseen_date] < "-30 days"? Or must I call other functions to make it work? EDIT: I saw this working on a different site, so I wrote the webmaster and asked. They are using a 3.0.x version, so I'd like to know what I need to do to get this to work with a 3.6.x version, or what I'm doing wrong so that this isn't working Since I want this to display in my profiles, I edit the member.php file. I'm not sure where is safe to put the code, so I placed it above the "Main Script Start" section. $time1weekago=time()-7776000; if ($userinfo[lastactivity] < $time1weekago ) { $isOlduser = 1; } else { $isOlduser = 0; } I then edit my MEMBERINFO template and place the IF conditional around the text, like this: <if conditional="$isOlduser=1">User has not logged in for 1 week!</if> Does anyone see anything 'wrong' with the above code, or why it might not be working for me? I had it output its values for me, and here is what I get for myself (last activity is today): Time 1 Week Ago: 1187212461 Last Activity: 1187817258 Is Old User: 1 This user has not logged in for 1 week! I checked a member that had not logged in in over a month, and here is what I got: Time 1 Week Ago: 1187212629 Last Activity: 1184946900 Is Old User: 1 This user has not logged in for 1 week! |
#4
|
|||
|
|||
Checking to see if anyone can take a look at this for me? See my last post, above.
|
#5
|
|||
|
|||
Anyone?
|
#6
|
|||
|
|||
PHP Code:
Code:
<if condition="$olduser == 1"> User has not logged in for 1 week! </if> You may want to add a new plugin instead of editing a file, a suitable hook location would be something like: memberinfo_complete. |
#7
|
||||
|
||||
No need for a plugin, just put the calculation in the template conditional ;
HTML Code:
<if condition="$userinfo[lastactivity] < (TIMENOW - 2592000)"> User has not logged in for 30 days </if> (The value 7776000 is 90 days, not 30) |
#8
|
|||
|
|||
WONDERFUL, thanks every so much.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|