From e5f26bf8ed5490e8eafd87f2d1f54aa3a85e510a Mon Sep 17 00:00:00 2001 From: Rich Lott / Artful Robot Date: Mon, 20 Feb 2023 13:46:04 +0000 Subject: [PATCH] standalone: when users extension not available create fake user IDs in session --- CRM/Utils/System/Standalone.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CRM/Utils/System/Standalone.php b/CRM/Utils/System/Standalone.php index 29677f3a44..148f53d46e 100644 --- a/CRM/Utils/System/Standalone.php +++ b/CRM/Utils/System/Standalone.php @@ -28,6 +28,20 @@ class CRM_Utils_System_Standalone extends CRM_Utils_System_Base { $this->missingStandaloneExtension = !class_exists(\Civi\Standalone\Security::class); } + /** + * Start a new session. + */ + public function sessionStart() { + parent::sessionStart(); + if ($this->missingStandaloneExtension) { + // Provide a fake contact and user ID, otherwise we don't get a menu. + $session = CRM_Core_Session::singleton(); + $session->set('userID', 1); + $session->set('ufID', 1); + } + } + + /** * @inheritdoc */ -- 2.25.1