Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

user account created on ?

edited July 2005 in Vanilla 1.0 Help
when i look at my admin user...there is an actual date displayed like "Jun 22nd 2005" but for every other user ther is "x hours, minutes or whatever ago" any idea why that could be? by the way i noticed that in this forum there is also a sort of inconsistency...try to search for users and leave the texfield blank...then you can see...some accounts say created 5 days ago and some have dates displayed. i dont know why this is...maybe its obvious but not for me :D

Comments

  • there is probably a threshold... like anything created in the last week get's displayed as "4 days ago" and anything over a week get's displayed as the actual date.
  • i believe when it goes over a certain time period it just displays the date.
  • BenBen
    edited July 2005
    i think anything over 7 days gets an actual date
  • omg echo?
  • is it the same with topic timestamps and so on? i just wondered because rails handles it the way that it displays weeks and months and even years after some time with the function "time_in_words_ago" yeah yeah i know this is php and no ruby/rails forum but i just thought it might behave the same :D
  • we're all just too fast jonezy
  • ichigo i'm pretty sure that mark will have coded it to act that way and that its not actually a php function. Though i could be completely wrong.
  • yeah i also dont know a php function that does something like that...but please correct me if im wrong :)
  • jonezyjonezy New
    edited July 2005
    here is how it is done.

    <dd>".TimeDiff($this->User->DateFirstVisit, mktime())."</dd>

    though that is from the account.php file i imagine it's the same everywhere else.
  • but is TimeDiff a function that mark's created? php.net says yes. In which case you could quite easily change it i think.
  • thanks for explaining :) it makes things clearer to me
  • p.s: function TimeDiff($Time, $TimeToCompare = "") { if ($TimeToCompare == "") $TimeToCompare = time(); $Difference = $TimeToCompare-$Time; $Days = floor($Difference/60/60/24); $Difference -= $Days*60*60*24; $Hours = floor($Difference/60/60); $Difference -= $Hours*60*60; $Minutes = floor($Difference/60); $Difference -= $Minutes*60; $Seconds = $Difference; if ($Days > 7) { return date("M jS Y", $Time); } elseif ($Days > 0) { return FormatPlural($Days, "day ago", "days ago"); } elseif ($Hours > 0) { return FormatPlural($Hours, "hour ago", "hours ago"); } elseif ($Minutes > 0) { return FormatPlural($Minutes, "minute ago", "minutes ago"); } else { return FormatPlural($Seconds, "second ago", "seconds ago"); } }
  • holy shit we were all bang on
  • As you can see, if you wanted to show the length of time ago regardless, you just need to play around with that if statement at the bottom there.
  • yeah that wont be to hard...thank you :)
  • p.s. If you need it, that function is in library/Utility.Functions.php - though i'm almost certain you could just re-define it in an extension and that'd take priority.
This discussion has been closed.