miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Bugs miniBB Support Forums / Bugs /  
 

Today/Yesterday bug when $timeDiff is set

 
Author Februs
Partaker
#1 | Posted: 3 Dec 2010 02:55 
I have my forum set to use a time difference of +6 hours by setting:

$timeDiff=21600;

However, any posts which occur between midnight and 6am show as Yesterday rather than today. For example:

Last 6 posts on recent topics list:

Today, 06:45am
Today, 06:15am
Yesterday, 03:22am
Yesterday, 02:18am

My users find this confusing and I'm not clear if this is how it is meant to work or whether I've not set things up correctly. If this is how it is meant to be can someone advise how I could change it so that any posts made after midnight (once the 6 hour time difference has been applied) show as being TODAY. I did take a look at the date functions in bb_functions.php but wasn't sure what to change.

Many thanks in advance for any help.

Author Paul
Lead Developer 
#2 | Posted: 3 Dec 2010 04:01 
Honestly nobody from us tested this option earlier for Today/Yesterday statement, that's why I think there may be a bug.

You may try the following: edit bb_functions.php, and before convert_date() function there are couple of lines of code:

$GLOBALS['today']=date('Y-m-d');
$GLOBALS['yesterday']=date('Y-m-d', time()-86400);
they should be changed to:

if(!isset($timeDiff)) $currentTime=time(); else $currentTime=time()+$timeDiff;
$GLOBALS['today']=date('Y-m-d', $currentTime);
$GLOBALS['yesterday']=date('Y-m-d', $currentTime-86400);
try it and let us know if it worked.

Author Februs
Partaker
#3 | Posted: 3 Dec 2010 11:42 
Thanks for suggesting the changes. I tried them but that didn't fix the problem. Anyway, I've looked further at the code and made the following changes and that seems to have done it:

Before the convert_date() function:

if(!isset($GLOBALS['timeDiff'])) $currentTime=time(); else $currentTime=time()+$GLOBALS['timeDiff'];
$GLOBALS['today']=date('Y-m-d', $currentTime);
$GLOBALS['yesterday']=date('Y-m-d', $currentTime-86400);
and then within the convert_date() function itself:

$dfval=strtotime($dateR);
if(isset($GLOBALS['timeDiff']) and $GLOBALS['timeDiff']!=0) $dfval+=$GLOBALS['timeDiff'];

$dateR1 = date('Y-m-d H:i:s', $dfval);

if(isset($GLOBALS['dateOnlyFormat']) and isset($GLOBALS['l_today']) and isset($GLOBALS['l_yesterday'])) {
if(substr($dateR1, 0, 10)==$GLOBALS['today']) $dateR=$GLOBALS['l_today'].', '.date($GLOBALS['timeOnlyFormat'], $dfval);
elseif(substr($dateR1, 0, 10)==$GLOBALS['yesterday']) $dateR=$GLOBALS['l_yesterday'].', '.date($GLOBALS['timeOnlyFormat'], $dfval);
else $dateR=date($GLOBALS['dateFormat'], $dfval);
}
else $dateR=date($GLOBALS['dateFormat'], $dfval);
__

Author Paul
Lead Developer 
#4 | Posted: 6 Dec 2010 08:39 
Thank you, it appears to work. We'll improve it in the next release.
[Fixed in 3.0]

Bugs miniBB Support Forums / Bugs /
 Today/Yesterday bug when $timeDiff is set
 Share Topic's Link

This topic is closed. New replies are not allowed.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Proceed with the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑