Fixed Bug: Problem using WordPress date-time type in forum
I wasn't having problems before, but now my forum is stuck on the DD/MM/YYYY format. Cleared all caches, tried resaving the WP date setting and the WPforo setting and no change.
Please provide more information.
- What is your WP date format?
- Have you enabled WP date format in Forums > Settings > Features admin page?
- Have you deleted wpForo Cache and other plugin caches?
- Where exactly you see that problem, please leave some screen.
Its better this way, just leave it as it is 😉
Thank you for the bug report. We found the issue and fixed. It'll be included in next update very soon.
As a patch, if you want to fix it manually using Plugin Editor or Hosing cPanel > File Manager:
Open: wp-content/plugins/wpforo/wpf-includes/functions.php file.
Find this function (line from 1231 to 1252 included ):
function wpforo_date_format($type){
if( in_array($type, array('datetime', 'date', 'time')) ){
if( wpforo_feature('wp-date-format') ){
$date_format = get_option('date_format');
$time_format = get_option('time_format');
}else{
$date_format = 'Y-m-d';
$time_format = 'H:i:s';
}
$sep = ' ';
if( $type == 'datetime' ){
$type = $date_format . $sep . $time_format;
}elseif( $type == 'date' ) {
$type = $date_format;
}elseif( $type = 'time' ){
$type = $time_format;
}
}
return $type;
}
Change it to this:
function wpforo_date_format($type){
$sep = ' ';
$wp_format = wpforo_feature('wp-date-format');
if( $wp_format ){
$date_format = get_option('date_format');
$time_format = get_option('time_format');
} else {
$date_format = 'Y-m-d';
$time_format = 'H:i:s';
}
if( in_array($type, array('datetime', 'date', 'time')) ){
if( $type == 'datetime' ){
$type = $date_format . $sep . $time_format;
}elseif( $type == 'date' ) {
$type = $date_format;
}elseif( $type = 'time' ){
$type = $time_format;
}
} elseif( $wp_format ){
$type = $date_format . $sep . $time_format;
}
return $type;
}
Thank you for the bug report. We found the issue and fixed. It'll be included in next update very soon.
As a patch, if you want to fix it manually using Plugin Editor or Hosing cPanel > File Manager:
Open: wp-content/plugins/wpforo/wpf-includes/functions.php file.
WOW! I Like the QUOTES!! Thank you @Robert for posting the patch.
I would like to add that issues with dates were also noticed in non-English WP - for some WordPress Translations.
More info here:
https://wordpress.org/support/topic/date-format-not-displaying-correctly/
https://wordpress.org/support/topic/wp-5-does-not-recognize-the-date-format-l-j-f-y/
As Wordpress is open-source, the translations are also done by volunteers. I just thought I'd share that here, too.
So in case there are other Community Members here who have non-English Wordpress Installations, they can check their WP translation version in their native language and then maybe they can also help contribute to translate code 🙂
https://translate.wordpress.org/
Thanks again Robert for everything you and Sofy and Martin and Blackraz do for this FREE wpForo Forum!