Вот почему я хочу, чтобы местное время сохранялось и отображалось для часовой пояс Европы (смещение на 2 часа). Не уверен, ошибка это или нет.
В любом случае, когда я устанавливаю для $gmt значение false в основной функции Buddypress ниже, местное время сохраняется и все работает. Но это не лучший способ изменить ядро. Итак, как я могу добавить фильтр к этой функции и установить для $gmt значение FALSE?
Код: Выделить всё
/**
* Get the current GMT time to save into the DB.
*
* @since 1.2.6
*
* @param bool $gmt True to use GMT (rather than local) time. Default: true.
* @param string $type See the 'type' parameter in {@link current_time()}.
* Default: 'mysql'.
* @return string Current time in 'Y-m-d h:i:s' format.
*/
function bp_core_current_time( $gmt = **true**, $type = 'mysql' ) { // set gmt to false here works
/**
* Filters the current GMT time to save into the DB.
*
* @since 1.2.6
*
* @param string $value Current GMT time.
*/
return apply_filters( 'bp_core_current_time', current_time( $type, $gmt ) );
}
Код: Выделить всё
add_filter('bp_core_current_time','current_time2');
function current_time2 () {
return current_time($type='mysql',$gmt=false);
}
Код: Выделить всё
add_filter('bp_core_current_time','current_time2');
function current_time2 ($gmt) {
return $gmt=false;
}
Подробнее здесь: https://stackoverflow.com/questions/791 ... saved-from