From 75fc5022f0859dba3f3e930f0683f2bab1e7bfe2 Mon Sep 17 00:00:00 2001 From: NIU Administrator Date: Thu, 7 Jan 2021 19:10:11 +0900 Subject: [PATCH] fixed bug to update email and name by anonymous edit. --- functions.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/functions.php b/functions.php index bb236ff..80dff9e 100644 --- a/functions.php +++ b/functions.php @@ -504,13 +504,11 @@ function cbsonline_wpforo_edit_topic_data_filter($args) { if (!is_user_logged_in() && isset($args['name']) && isset($args['email'])) { $args['status'] = 0; - if ($args['name'] == wpforo_phrase('Anonymous', false)) { - $host = gethostbyaddr($_SERVER['REMOTE_ADDR'] ?? '127.0.0.1'); - if (false !== $host) { - // override name to hostname if name is 'Anonymous' - $args['name'] = $host; - } - } + $cookie = [ + 'name' => $args['name'], + 'email' => $args['email'], + ]; + WPF()->member->set_guest_cookies($cookie); } return $args;