Dates

Discussion in 'Admin Talk Support & Feedback' started by Paul M, Jun 19, 2009.

  1. Bundy

    Bundy Admin Talk Staff

    Joined:
    Apr 19, 2005
    Messages:
    842
    Likes Received:
    36
    Location:
    Boston

    Yeah thats what I was saying. He was asking to have the actual month added in. Instead of a number.

    I am glad I have seen this thread though. Because like I said no one has ever brought it up so I never really thought about it. SO I will either add the plugin above (if it works haha) or the expanded format.

    I personally like how it is set now. But after reading this it is time to reconsider. ;)
     
  2. Nick

    Nick Regular Member

    Joined:
    Jul 27, 2008
    Messages:
    7,441
    Likes Received:
    218
    That isn't the issue that is prevalent with 3.8. With 3.8 it says "this must be uploaded as a plugin" when you try to upload it in the product manager.

    So I had to manually enter the values and add it as a plugin, but it doesn't work.
     
  3. Paul M

    Paul M Dr Pepper Addict

    Joined:
    Jun 16, 2009
    Messages:
    449
    Likes Received:
    136
    Location:
    Nottingham, UK
    No .....................

    I clearly suggested putting the month in (Jan, Feb, Mar, Apr)


    I dont know how I could make the suggestion any clearer :confused:
     
  4. Nick

    Nick Regular Member

    Joined:
    Jul 27, 2008
    Messages:
    7,441
    Likes Received:
    218
    I just made the change to: Expanded US Format (e.g., April 25th, 1998): F jS, Y

    Is this suitable?
     
  5. Demo

    Demo Regular Member

    Joined:
    Jun 9, 2009
    Messages:
    172
    Likes Received:
    6
    Location:
    Europe
    First Name:
    Demo
    Much more understandable for me now :)
     
  6. Paul M

    Paul M Dr Pepper Addict

    Joined:
    Jun 16, 2009
    Messages:
    449
    Likes Received:
    136
    Location:
    Nottingham, UK
    Well thats much better as far as confusion/understanding is concerned, thanks.

    However, you may find its a bit long for some dates (like September). :D

    JFYI, what I suggested is d-M-Y :)
     
  7. Mark.B

    Mark.B Guest

    Nick I have *something* working on 3.8.1 that allows user selection - it involves a plugin and a custom profile field I think. I'll have a look later at how it's done, because to be honest I can't for the life of me remember what I used.

    I do know that I also have it showing at registration. I've never had a problem with it.
     
  8. Mark.B

    Mark.B Guest

    Ok checked and I have the same one Nick's trying to use, the one where you upload the plugin and create two user profile fields.

    However you do have to edit the plugin afterwards to reflect the id numbers of the two custom profile fields.

    Definitely working on 3.8.1 though. You can even set the fields to show at registration.
     
  9. Nick

    Nick Regular Member

    Joined:
    Jul 27, 2008
    Messages:
    7,441
    Likes Received:
    218
    That's what I did, Mark.

    Here is the plugin:

    Here are the contents of the plugin (the PHP code):
    PHP:
    <![CDATA[if ($vbulletin->userinfo['userid']) {
    // ############ Date Format as Uservalue ################
    switch ($vbulletin->userinfo['field21']) {
    case 
    'US Format':
    $vbulletin->options['dateformat'] = 'm-d-y';
    break;
    case 
    'Expanded US Format':
    $vbulletin->options['dateformat'] = 'M jS, Y';
    break;
    case 
    'European Format':
    $vbulletin->options['dateformat'] = 'd-m-y';
    break;
    case 
    'Expanded European Format':
    $vbulletin->options['dateformat'] = 'jS M Y';
    break;
    default:
    $vbulletin->options['dateformat'] = 'm-d-y';
    }

    // ############ Time Format as Uservalue ################
    switch ($vbulletin->userinfo['field22']) {
    case 
    '12-Hour Time Format':
    $vbulletin->options['timeformat'] = 'h:i A';
    break;
    case 
    '24-Hour Time Format':
    $vbulletin->options['timeformat'] = 'H:i';
    break;
    default:
    $vbulletin->options['timeformat'] = 'h:i A';
    }
    }]]>
    ... Is that the same as yours (except for the field IDs?)

    And here are the profile fields:
    View attachment 302


    And when I adjust the settings in my UserCP, nothing changes in terms of date stamps on posts. You can try it out here.

    Am I missing something?
     
  10. Mark.B

    Mark.B Guest

    Here is my plugin:
    Code:
    if ($vbulletin->userinfo['userid']) {
    // ############ Date Format as Uservalue ################
    switch ($vbulletin->userinfo['field47']) {
    case 'US Format':
    $vbulletin->options['dateformat'] = 'm-d-y';
    break;
    case 'Expanded US Format':
    $vbulletin->options['dateformat'] = 'F jS, Y';
    break;
    case 'European Format':
    $vbulletin->options['dateformat'] = 'd-m-y';
    break;
    case 'Expanded European Format':
    $vbulletin->options['dateformat'] = 'jS F Y';
    break;
    default:
    $vbulletin->options['dateformat'] = 'jS F Y';
    }
    
    // ############ Time Format as Uservalue ################
    switch ($vbulletin->userinfo['field48']) {
    case '12-Hour Time Format':
    $vbulletin->options['timeformat'] = 'h:i A';
    break;
    case '24-Hour Time Format':
    $vbulletin->options['timeformat'] = 'H:i';
    break;
    default:
    $vbulletin->options['timeformat'] = 'H:i';
    }
    }
    And these are my profile fields:

    View attachment 304

    View attachment 305

    Obviously this will give a UK format default but that can be changed easily enough.
     
    2 people like this.
  11. Nick

    Nick Regular Member

    Joined:
    Jul 27, 2008
    Messages:
    7,441
    Likes Received:
    218
    It's probably my first line that's the problem:
    PHP:
    <![CDATA[if ($vbulletin->userinfo['userid']) {
     
  12. Mark.B

    Mark.B Guest

    Yes...you've copied the XML code from the file as well as the actual plugin code.

    Trim that out and it ought to work.
     
  13. Wayne Luke

    Wayne Luke Regular Member

    Joined:
    Apr 2, 2009
    Messages:
    991
    Likes Received:
    276
    Can't wait to use '{vb:date post.dateline,{vb:raw bbuserinfo.fieldx}}' in styles in the future. fieldx would simply reference the User Profile Field where they store the format they want.
     
  14. Nick

    Nick Regular Member

    Joined:
    Jul 27, 2008
    Messages:
    7,441
    Likes Received:
    218
    ....And it works. :D

    Enjoy guys. Again, the settings are in your UserCP -> Edit Options -> Date and Time Options
     
  15. Mark.B

    Mark.B Guest

    I've mixed feelings on that, insofar as it's fantastic BUT the thought of trawling through my 4,568 (approx!) customised templates and changing everything makes me feel a bit ill.
     
  16. Mark.B

    Mark.B Guest

    Brilliant, glad you got it working and glad to have been of assistance.

    Perhaps our plugin code should be deleted now, as effectively we've "released" the modification here now....and it should really only be obtained via vbulletin.org.
     
  17. Nick

    Nick Regular Member

    Joined:
    Jul 27, 2008
    Messages:
    7,441
    Likes Received:
    218
    Yes, thank you for your help Mark.

    And good point; I've removed the posts. ;)
     
  18. Wayne Luke

    Wayne Luke Regular Member

    Joined:
    Apr 2, 2009
    Messages:
    991
    Likes Received:
    276
    Your vBulletin 3 templates aren't going to be compatible with vBulletin 4. No one's will. It will be the same thing that happened when we switched from vBulletin 2 to vBulletin 3. And yes, it is a big pain for everyone. Off-topic here now though the thread is resolved so...
     
  19. Mark.B

    Mark.B Guest

    Oh yes, I'm not really complaining about it as such, it's just not a job I'm looking forward to...nor even necessarily going to bother with at all. Besides the licensing issues, I'm not sure vB4 will offer anything for my site at all, and given the obvious fact that most plugins will fail, would in many ways be a backward step for us, at least until the main hacks are converted over.

    I remember the vb2 > vb3 change, although from memory a "basic" representation of your vb2 styles was created, which in my case worked pretty well and I just tweaked from that point to make it 100%. But my board is more customised now than then, some of the plugins I have written myself and I will struggle to convert those as I just don't understand the new variables.....

    None of this is a criticism of vB just the position I find myself in. My years of tweaks and experience will go down the pan with vb4 and I'm not sure I have inclination to re-learn it all.
     
  20. Paul M

    Paul M Dr Pepper Addict

    Joined:
    Jun 16, 2009
    Messages:
    449
    Likes Received:
    136
    Location:
    Nottingham, UK
    Perfect :D
     

Share This Page