Welcome, Guest. Please Login or Register.
April 30, 2025, 05:00:14 AM
Home Help Search Log in Register
News: SMF is the next generation in forum software, almost completely re-written from the ground up, make sure you don't fall for cheap imitations that suffer from feature bloat!

YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Yesterday/Today/Tomorrow Mod « previous next »
Pages: [1] 2 Reply Ignore Print
Author Topic: Yesterday/Today/Tomorrow Mod  (Read 937 times)
John R
PHP Challenged
Global Moderator
Sr. Member
*****
Posts: 387


Click, Click, Click, Bang!

ICQ - 3166233codehammer@thevortex.com
Yesterday/Today/Tomorrow Mod
« on: January 23, 2002, 04:20:16 AM »
Reply with quote

Somewhere, in an earlier post, possibly on a different board, I saw mention of an inspired Mod.  The optomistic user wanted a Yesterday/Today/Tomorrow Mod.  I wish I could offer all that was requested but alas, my coding skills are just not that good.  Since the Today part was included with the updated source, the job was 1/3 complete.  Now, with a little help from Jeff, here's part 2 - Yesterday

In English.lng you need to find
$txt['yse10'] = "<b>Today</b> at ";
after it you need to add this line
$txt['yse10b'] = "<b>Yesterday</b> at ";

In subs.php you need to find
function timeformat ($logTime){
   global $timeformatstring,$username,$settings,$timeoffset,$txt,$db_prefix,$locale;
   if (!isset($GLOBALS['todayMod']))
   {
      // pre-load variable so we don't query too much
      $req = mysql_query("SELECT value FROM {$db_prefix}settings WHERE variable='todayMod'");
      list($GLOBALS['todayMod'])=mysql_fetch_row($req);
   }
   $time = isset($settings[18])?$settings[18]:0;
   $time = ($timeoffset+$time)*3600;
   $nowtime = $time+time();
   $time += $logTime;
   if ($GLOBALS['todayMod']=='1')
   {
      $t1 = getdate($time);
      $t2 = getdate($nowtime);
      if ($t1['yday']==$t2['yday'] && $t1['year']==$t2['year'])
         return $txt['yse10'].date(" h:i:sa",$time);
   }
   setlocale(LC_TIME, $locale);
   if ($username == 'Guest' || $settings[17]=='')
      return strftime ($timeformatstring,$time);
   return strftime (stripslashes($settings[17]),$time);
}
and replace it with this
function timeformat ($logTime){
   global $timeformatstring,$username,$settings,$timeoffset,$txt,$db_prefix,$locale;
   if (!isset($GLOBALS['todayMod']))
   {
      // pre-load variable so we don't query too much
      $req = mysql_query("SELECT value FROM {$db_prefix}settings WHERE variable='todayMod'");
      list($GLOBALS['todayMod'])=mysql_fetch_row($req);
   }
   $time = isset($settings[18])?$settings[18]:0;
   $time = ($timeoffset+$time)*3600;
   $nowtime = $time+time();
   $time += $logTime;
   if ($GLOBALS['todayMod']=='1')
   {
      $t1 = getdate($time);
      $t2 = getdate($nowtime);
      if ($t1['yday']==$t2['yday'] && $t1['year']==$t2['year'])
         return $txt['yse10'].date(" h:i:sa",$time);
      if ($t1['yday']==($t2['yday']-1) && $t1['year']==$t2['year'])
         return $txt['yse10b'].date(" h:i:sa",$time);
   }
   setlocale(LC_TIME, $locale);
   if ($username == 'Guest' || $settings[17]=='')
      return strftime ($timeformatstring,$time);
   return strftime (stripslashes($settings[17]),$time);
}

Now when a user views a board index, any post that was written Yesterday will be displayed with the date as Yesterday instead of the date, just like the Today Mod.  * NOTE * You do have to have the Today Mod enabled as the Yesterday feature works in conjunction with the Today feature.

So, that optomistic users request is now 2/3 complete but it will take a much better coder than myself to come up with the code for the final part of the request - the Tomorrow part.

cheers..........
« Last Edit: January 23, 2002, 04:30:10 AM by John R » Logged

Be careful what you wish for, it might come true!

Note: I do not acknowledge support requests via PM, MSN or ICQ, please use the support boards.
Webby
Beta Tester
YaBB God
*****
Posts: 829


Some mistakes are too funny to make only once.

ICQ - 9814812webby@salesplaza.nl WWW
Re:Yesterday/Today/Tomorrow Mod
« Reply #1 on: January 23, 2002, 06:26:18 AM »
Reply with quote

making backup..............

copy-paste.......................

fingers crossed.......testing...........

no........

Didn't work........

It shows just the date, and not "Yesterday"........... :-\
Logged

Webby of salesplaza.nl
The YaBBSE buttongenerator : Click HERE !
John R
PHP Challenged
Global Moderator
Sr. Member
*****
Posts: 387


Click, Click, Click, Bang!

ICQ - 3166233codehammer@thevortex.com
Re:Yesterday/Today/Tomorrow Mod
« Reply #2 on: January 23, 2002, 07:07:10 AM »
Reply with quote

Obviously, it's something that you did wrong.

Logged

Be careful what you wish for, it might come true!

Note: I do not acknowledge support requests via PM, MSN or ICQ, please use the support boards.
Webby
Beta Tester
YaBB God
*****
Posts: 829


Some mistakes are too funny to make only once.

ICQ - 9814812webby@salesplaza.nl WWW
Re:Yesterday/Today/Tomorrow Mod
« Reply #3 on: January 23, 2002, 07:15:10 AM »
Reply with quote

..........copy-paste...........

......test.........

......hit myself on the head with my keyboard........!

It works  ;D

Logged

Webby of salesplaza.nl
The YaBBSE buttongenerator : Click HERE !
Markie
Noobie
*
Posts: 24


I am Cool

Re:Yesterday/Today/Tomorrow Mod
« Reply #4 on: January 23, 2002, 02:47:19 PM »
Reply with quote

Question:

I can't find that string in subs.php

I have this:


function timeformat ($logTime){
   global $timeformatstring,$username,$settings,$timeoffset,$txt,$db_prefix;
   if (!isset($GLOBALS['todayMod']))
   {
      // pre-load variable so we don't query too much
      $req = mysql_query("SELECT value FROM {$db_prefix}settings WHERE variable='todayMod'");
      list($GLOBALS['todayMod'])=mysql_fetch_row($req);
   }
   $time = isset($settings[18])?$settings[18]:0;
   $time = ($timeoffset+$time)*3600;
   $nowtime = $time+time();
   $time += $logTime;
   if ($GLOBALS['todayMod']=='1')
   {
      $t1 = getdate($time);
      $t2 = getdate($nowtime);
      if ($t1['yday']==$t2['yday'] && $t1['year']==$t2['year'])
         return $txt['yse10'].date(" h:i:sa",$time);
   }
   if ($username == 'Guest' || $settings[17]=='')
      return date($timeformatstring,$time);
   return date($settings[17],$time);
}



I run 1.0.0 , could I get it too work on my board?
Logged
scx
Full Member
***
Posts: 218


Re:Yesterday/Today/Tomorrow Mod
« Reply #5 on: January 23, 2002, 05:52:09 PM »
Reply with quote

Probably you can just add
if ($t1['yday']==($t2['yday']-1) && $t1['year']==$t2['year'])
         return $txt['yse10b'].date(" h:i:sa",$time);

after
if ($t1['yday']==$t2['yday'] && $t1['year']==$t2['year'])
         return $txt['yse10'].date(" h:i:sa",$time);

It seems it'll work. ;)
Logged
Jeff Lewis
Global Moderator
YaBB God
*****
Posts: 10149


I'm a llama!

WWW
Re:Yesterday/Today/Tomorrow Mod
« Reply #6 on: January 23, 2002, 06:51:36 PM »
Reply with quote

Hehe I'd love to talk to the person that does the tomorrow mod ;)  Going to be hard to mark tomorrow on posts that haven't happened yet ;)
Logged

Q-Magz
Noobie
*
Posts: 12


I love YaBB SE!

ICQ - 5660635 WWW
Re:Yesterday/Today/Tomorrow Mod
« Reply #7 on: January 23, 2002, 07:09:02 PM »
Reply with quote

Quote from: John R on January 23, 2002, 04:20:16 AMSomewhere, in an earlier post, possibly on a different board, I saw mention of an inspired Mod.  The optomistic user wanted a Yesterday/Today/Tomorrow Mod.  I wish I could offer all that was requested but alas, my coding skills are just not that good.  Since the Today part was included with the updated source, the job was 1/3 complete.  Now, with a little help from Jeff, here's part 2 - Yesterday

In English.lng you need to find
$txt['yse10'] = "<b>Today</b> at ";
after it you need to add this line
$txt['yse10c'] = "<b>Tomorrow</b> at ";

In subs.php you need to find
function timeformat ($logTime){
   global $timeformatstring,$username,$settings,$timeoffset,$txt,$db_prefix,$locale;
   if (!isset($GLOBALS['todayMod']))
   {
      // pre-load variable so we don't query too much
      $req = mysql_query("SELECT value FROM {$db_prefix}settings WHERE variable='todayMod'");
      list($GLOBALS['todayMod'])=mysql_fetch_row($req);
   }
   $time = isset($settings[18])?$settings[18]:0;
   $time = ($timeoffset+$time)*3600;
   $nowtime = $time+time();
   $time += $logTime;
   if ($GLOBALS['todayMod']=='1')
   {
      $t1 = getdate($time);
      $t2 = getdate($nowtime);
      if ($t1['yday']==$t2['yday'] && $t1['year']==$t2['year'])
         return $txt['yse10'].date(" h:i:sa",$time);
      if ($t1['yday']==($t2['yday']-1) && $t1['year']==$t2['year'])
         return $txt['yse10b'].date(" h:i:sa",$time);
   }
   setlocale(LC_TIME, $locale);
   if ($username == 'Guest' || $settings[17]=='')
      return strftime ($timeformatstring,$time);
   return strftime (stripslashes($settings[17]),$time);
}
and replace it with this
function timeformat ($logTime){
   global $timeformatstring,$username,$settings,$timeoffset,$txt,$db_prefix,$locale;
   if (!isset($GLOBALS['todayMod']))
   {
      // pre-load variable so we don't query too much
      $req = mysql_query("SELECT value FROM {$db_prefix}settings WHERE variable='todayMod'");
      list($GLOBALS['todayMod'])=mysql_fetch_row($req);
   }
   $time = isset($settings[18])?$settings[18]:0;
   $time = ($timeoffset+$time)*3600;
   $nowtime = $time+time();
   $time += $logTime;
   if ($GLOBALS['todayMod']=='1')
   {
      $t1 = getdate($time);
      $t2 = getdate($nowtime);
      if ($t1['yday']==$t2['yday'] && $t1['year']==$t2['year'])
         return $txt['yse10'].date(" h:i:sa",$time);
      if ($t1['yday']==($t2['yday']-1) && $t1['year']==$t2['year'])
         return $txt['yse10b'].date(" h:i:sa",$time);
      if ($t1['yday']==($t2['yday']+1) && $t1['year']==$t2['year'])
         return $txt['yse10c'].date(" h:i:sa",$time);
   }
   setlocale(LC_TIME, $locale);
   if ($username == 'Guest' || $settings[17]=='')
      return strftime ($timeformatstring,$time);
   return strftime (stripslashes($settings[17]),$time);
}

Now when a user views a board index, any post that was written Yesterday will be displayed with the date as Yesterday instead of the date, just like the Today Mod.  * NOTE * You do have to have the Today Mod enabled as the Yesterday feature works in conjunction with the Today feature.

So, that optomistic users request is now 2/3 complete but it will take a much better coder than myself to come up with the code for the final part of the request - the Tomorrow part.

cheers..........


after you install yesterday mod, install this, and you've got a really usefull tomorrow mod :)
Logged
Jeff Lewis
Global Moderator
YaBB God
*****
Posts: 10149


I'm a llama!

WWW
Re:Yesterday/Today/Tomorrow Mod
« Reply #8 on: January 23, 2002, 07:10:37 PM »
Reply with quote

Tomorrow mod?  Does this seem to strange to only me?

"This posted was posted tomorrow".
Logged

Markie
Noobie
*
Posts: 24


I am Cool

Re:Yesterday/Today/Tomorrow Mod
« Reply #9 on: January 23, 2002, 07:11:47 PM »
Reply with quote

Quote from: scx on January 23, 2002, 05:52:09 PMProbably you can just add
if ($t1['yday']==($t2['yday']-1) && $t1['year']==$t2['year'])
         return $txt['yse10b'].date(" h:i:sa",$time);

after
if ($t1['yday']==$t2['yday'] && $t1['year']==$t2['year'])
         return $txt['yse10'].date(" h:i:sa",$time);

It seems it'll work. ;)
hey thnx!

but now my normal time format's show up as F jS, Y, h:i:s a
with what should I replace that in the admin?
Logged
£eo
Jr. Member
**
Posts: 91


I really do love YaBBSE :-)

WWW
Re:Yesterday/Today/Tomorrow Mod
« Reply #10 on: January 23, 2002, 07:22:05 PM »
Reply with quote

QuoteDoes this seem to strange to only me?
no,  i feel a little strange to me to   ;D


and the yesterday mod also,,   it made all my posts to "todays" posts     ;)

Logged

Markie
Noobie
*
Posts: 24


I am Cool

Re:Yesterday/Today/Tomorrow Mod
« Reply #11 on: January 23, 2002, 07:29:29 PM »
Reply with quote

ok update i've been trying and this is what I get:
when I play with time setting codes:

%D = %Wed @ the top of the board
D = Wed @ the top of the board

%D = Wed @ the top of the board
D= D next to a topic

get it???
 :-\
Logged
Q-Magz
Noobie
*
Posts: 12


I love YaBB SE!

ICQ - 5660635 WWW
Re:Yesterday/Today/Tomorrow Mod
« Reply #12 on: January 23, 2002, 08:01:45 PM »
Reply with quote

Quote from: Jeff Lewis on January 23, 2002, 07:10:37 PMTomorrow mod?  Does this seem to strange to only me?

"This posted was posted tomorrow".
well.. it is strange, but not unthinkable, what if you turn the forum clock 24H back ? ;)
Logged
Jeff Lewis
Global Moderator
YaBB God
*****
Posts: 10149


I'm a llama!

WWW
Re:Yesterday/Today/Tomorrow Mod
« Reply #13 on: January 23, 2002, 08:04:27 PM »
Reply with quote

hehe it's a stretch...you users are great ;)
Logged

Markie
Noobie
*
Posts: 24


I am Cool

Re:Yesterday/Today/Tomorrow Mod
« Reply #14 on: January 23, 2002, 08:18:02 PM »
Reply with quote

Someone please help me.. :-[
Logged
Pages: [1] 2 Reply Ignore Print 
YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Yesterday/Today/Tomorrow Mod « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.049 seconds with 18 queries.