vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Datestamp type per user (https://vborg.vbsupport.ru/showthread.php?t=262509)

Ian Cunningham 04-23-2011 01:48 PM

Datestamp type per user
 
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?

kh99 04-24-2011 03:25 PM

I don't know if there's an existing mod or not, but you could create a radio button custom profile field with options:

Code:

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:

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 [DATE]1303739419[/DATE] at [TIME]1303739419[/TIME] ---------------

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 [DATE]1303740017[/DATE] at [TIME]1303740017[/TIME] ---------------

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 [DATE]1303741519[/DATE] at [TIME]1303741519[/TIME] ---------------

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.


All times are GMT. The time now is 07:32 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00952 seconds
  • Memory Usage 1,719KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete