如何覆盖主题文件夹的functions.php中的插件功能?
编辑:
下面是我的代码:
if(!function_exists('userphoto_filter_get_avatar')){
function userphoto_filter_get_avatar($avatar, $id_or_email, $size, $default){
global $userphoto_using_avatar_fallback, $wpdb, $userphoto_prevent_override_avatar;
if($userphoto_using_avatar_fallback)
return $avatar;
if(is_object($id_or_email)){
if($id_or_email->ID)
$id_or_email = $id_or_email->ID;
//Comment
else if($id_or_email->user_id)
$id_or_email = $id_or_email->user_id;
else if($id_or_email->comment_author_email)
$id_or_email = $id_or_email->comment_author_email;
}
if(is_numeric($id_or_email))
$userid = (int)$id_or_email;
else if(is_string($id_or_email))
$userid = (int)$wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_email = '" . mysql_escape_string($id_or_email) . "'");
if(!$userid)
return $avatar;
//Figure out which one is closest to the size that we have for the full or the thumbnail
$full_dimension = get_option('userphoto_maximum_dimension');
$small_dimension = get_option('userphoto_thumb_dimension'); …Run Code Online (Sandbox Code Playgroud) 请帮助我,纠正我错的地方.下面是我的代码,当时区是英国它将打印其他部分为什么真的不明白.
$user = User::find(BaseHelper::getCurrentUser());
if($user->timezone ='UK')
{
$date = Carbon::createFromFormat('Y-m-d H:i:s', $this->updated, 'GMT');
$date->timezone("Europe/London");
} else {
$date = Carbon::parse($this->updated)->format('d/m/Y h:i A');
}
Run Code Online (Sandbox Code Playgroud)