View Full Version : Datestamp type per user
Ian Cunningham
04-23-2011, 01:48 PM
I'm looking for a way for users to alter how the datestamp appears, so instead of having a global setting for threads saying posted "5 minutes ago" it will show the time/date.
There was an old mod that did this, but it has been moved to the archive and the author no longer has the code:
https://vborg.vbsupport.ru/showthread.php?t=96505
Is there any other mod that can do this?
I don't know if there's an existing mod or not, but you could create a radio button custom profile field with options:
Forum Default
Normal
Yesterday / Today
Detailed
(I copy and pasted the description from the "Datestamp Display Option" vb option.) Then create a plugin using global_setup_complete hook location (other hooks would probably work as well), with this code:
switch ($vbulletin->userinfo['fieldX'])
{
case 'Normal':
$vbulletin->options['yestoday'] = 0;
break;
case 'Yesterday / Today':
$vbulletin->options['yestoday'] = 1;
break;
case 'Detailed':
$vbulletin->options['yestoday'] = 2;
break;
case 'Forum Default':
default:
// Don't change value
break;
}
(of course you need to replace the X in the first line with the actual field number you created.)
Boofo
04-24-2011, 03:53 PM
Yep, Kevin's way is the best way to do it. You would just need to check for the proper field number in the settings and you should be good to go.
Ian Cunningham
04-25-2011, 12:02 PM
Thanks for this, that's a huge help and will get me on the right track. :D
Simple and elegant solution!
--------------- Added 1303739419 at 1303739419 ---------------
I've almost got this working using your code above - although on 3.8 if I choose one the 'Normal' or 'Yesterday / Today' option it doesn't show the time - only the Today/Yesterday/01-01-2001 part. Is there a way to fix that?
--------------- Added 1303740017 at 1303740017 ---------------
I've done some more looking around and it looks like it may have something to do with $show['detailedtime'] in the templates? If that isn't set then it won't show the time - would that have something to do with this?
--------------- Added 1303741519 at 1303741519 ---------------
Changed global_setup_complete to global_start and it seems to work :D
Boofo
04-25-2011, 01:48 PM
I would try global_init_bootstrap_start as global_start is deprecated, or going to be, anyway, IIRC.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.