From dc9e823fbf31e7c9f29eca18bc459f9c4293f693 Mon Sep 17 00:00:00 2001 From: George Sokianos Date: Sun, 13 Oct 2024 14:09:20 +0100 Subject: [PATCH] Fix: uid is lost when user edit own article --- class/Item.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/class/Item.php b/class/Item.php index 08cd359a..04f28a72 100644 --- a/class/Item.php +++ b/class/Item.php @@ -1157,7 +1157,12 @@ public function setVarsFromRequest() $this->setVar('dobr', $this->helper->getConfig('submit_dobr')); $this->setVar('votetype', $this->helper->getConfig('ratingbars')); } else { - $this->setVar('uid', Request::getInt('uid', 0, 'POST')); + $author_uid = Request::getInt('uid', 0, 'POST'); + if(!$author_uid) { + $author_uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->uid() : 0; + } + + $this->setVar('uid', $author_uid); $this->setVar('cancomment', Request::getInt('allowcomments', 1, 'POST')); $this->setVar('status', Request::getInt('status', 1, 'POST')); $this->setVar('dohtml', Request::getInt('dohtml', 1, 'POST'));