From d574a3b981b7f6484e1d72d281b5acc47e41e71b Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Mon, 10 Jan 2022 09:36:11 +0100 Subject: [PATCH] Make sure the user ID and role slug are available on all backend pages. --- application/controllers/About.php | 5 +++++ application/controllers/Admins.php | 2 +- application/controllers/Booking_settings.php | 4 ++++ application/controllers/Business_settings.php | 4 ++++ application/controllers/Customers.php | 4 ++-- application/controllers/General_settings.php | 2 ++ application/controllers/Legal_settings.php | 4 ++++ application/controllers/Secretaries.php | 2 +- 8 files changed, 23 insertions(+), 4 deletions(-) diff --git a/application/controllers/About.php b/application/controllers/About.php index 2d6985a1..efdee387 100644 --- a/application/controllers/About.php +++ b/application/controllers/About.php @@ -56,6 +56,11 @@ class About extends EA_Controller { $role_slug = session('role_slug'); + script_vars([ + 'user_id' => $user_id, + 'role_slug' => $role_slug, + ]); + html_vars([ 'page_title' => lang('settings'), 'active_menu' => PRIV_SYSTEM_SETTINGS, diff --git a/application/controllers/Admins.php b/application/controllers/Admins.php index 4e99f363..2447bda5 100644 --- a/application/controllers/Admins.php +++ b/application/controllers/Admins.php @@ -53,9 +53,9 @@ class Admins extends EA_Controller { $role_slug = session('role_slug'); script_vars([ - 'timezones' => $this->timezones->to_array(), 'user_id' => $user_id, 'role_slug' => $role_slug, + 'timezones' => $this->timezones->to_array(), 'min_password_length' => MIN_PASSWORD_LENGTH, ]); diff --git a/application/controllers/Booking_settings.php b/application/controllers/Booking_settings.php index e4426447..978cae12 100644 --- a/application/controllers/Booking_settings.php +++ b/application/controllers/Booking_settings.php @@ -53,8 +53,12 @@ class Booking_settings extends EA_Controller { } $user_id = session('user_id'); + + $role_slug = session('role_slug'); script_vars([ + 'user_id' => $user_id, + 'role_slug' => $role_slug, 'booking_settings' => $this->settings_model->get_batch() ]); diff --git a/application/controllers/Business_settings.php b/application/controllers/Business_settings.php index 98682ba7..9867475b 100644 --- a/application/controllers/Business_settings.php +++ b/application/controllers/Business_settings.php @@ -53,8 +53,12 @@ class Business_settings extends EA_Controller { } $user_id = session('user_id'); + + $role_slug = session('role_slug'); script_vars([ + 'user_id' => $user_id, + 'role_slug' => $role_slug, 'business_settings' => $this->settings_model->get(), 'first_weekday' => setting('first_weekday'), 'time_format' => setting('time_format'), diff --git a/application/controllers/Customers.php b/application/controllers/Customers.php index 6f4a0279..03a9c4f0 100644 --- a/application/controllers/Customers.php +++ b/application/controllers/Customers.php @@ -72,11 +72,11 @@ class Customers extends EA_Controller { } script_vars([ + 'user_id' => $user_id, + 'role_slug' => $role_slug, 'date_format' => $date_format, 'time_format' => $time_format, 'timezones' => $this->timezones->to_array(), - 'user_id' => $user_id, - 'role_slug' => $role_slug, 'secretary_providers' => $secretary_providers, ]); diff --git a/application/controllers/General_settings.php b/application/controllers/General_settings.php index 530c8c4e..4291adb8 100644 --- a/application/controllers/General_settings.php +++ b/application/controllers/General_settings.php @@ -46,6 +46,8 @@ class General_settings extends EA_Controller { $user_id = session('user_id'); script_vars([ + 'user_id' => $user_id, + 'role_slug' => $role_slug, 'general_settings' => $this->settings_model->get(), ]); diff --git a/application/controllers/Legal_settings.php b/application/controllers/Legal_settings.php index ed2f2b6e..4d01e6ec 100644 --- a/application/controllers/Legal_settings.php +++ b/application/controllers/Legal_settings.php @@ -44,8 +44,12 @@ class Legal_settings extends EA_Controller { } $user_id = session('user_id'); + + $role_slug = session('role_slug'); script_vars([ + 'user_id' => $user_id, + 'role_slug' => $role_slug, 'legal_settings' => $this->settings_model->get(), ]); diff --git a/application/controllers/Secretaries.php b/application/controllers/Secretaries.php index a95c689d..17d3d902 100644 --- a/application/controllers/Secretaries.php +++ b/application/controllers/Secretaries.php @@ -65,9 +65,9 @@ class Secretaries extends EA_Controller { } script_vars([ - 'timezones' => $this->timezones->to_array(), 'user_id' => $user_id, 'role_slug' => $role_slug, + 'timezones' => $this->timezones->to_array(), 'min_password_length' => MIN_PASSWORD_LENGTH, 'providers' => $providers, ]);