diff --git a/src/administrator/language/en-GB/plg_system_mokojoomtos.ini b/src/administrator/language/en-GB/plg_system_mokojoomtos.ini
index f342ea9..21f5649 100644
--- a/src/administrator/language/en-GB/plg_system_mokojoomtos.ini
+++ b/src/administrator/language/en-GB/plg_system_mokojoomtos.ini
@@ -13,7 +13,10 @@ PLG_SYSTEM_MOKOJOOMTOS_FIELD_TOS_SLUG_DESC="Enter the menu slug for your Terms o
; Help
PLG_SYSTEM_MOKOJOOMTOS_HELP_LABEL="How to Use This Plugin"
-PLG_SYSTEM_MOKOJOOMTOS_HELP_DESC="Step 1: Create a Joomla article for your Terms of Service.
Step 2: Create a menu item pointing to that article.
Step 3: Set the menu item alias/slug (e.g., 'terms-of-service').
Step 4: Enter that same slug above.
Step 5: When your site goes offline, visitors can still access your-site.com/terms-of-service"
+PLG_SYSTEM_MOKOJOOMTOS_HELP_DESC="Step 1: Create a Joomla article for your Terms of Service.
Step 2: Create a menu item pointing to that article.
Step 3: Set the menu item alias/slug (e.g., 'terms-of-service').
Step 4: Enter that same slug above.
Step 5: When your site goes offline, visitors can still access yoursite.com/terms-of-service"
+
+; Errors
+PLG_SYSTEM_MOKOJOOMTOS_ERROR_LOADING_MENU_ITEMS="Error loading menu items: %s"
; Installation messages
PLG_SYSTEM_MOKOJOOMTOS_INSTALL_SUCCESS="MokoJoomTOS Plugin installed successfully!"
diff --git a/src/administrator/language/en-US/plg_system_mokojoomtos.ini b/src/administrator/language/en-US/plg_system_mokojoomtos.ini
index f342ea9..21f5649 100644
--- a/src/administrator/language/en-US/plg_system_mokojoomtos.ini
+++ b/src/administrator/language/en-US/plg_system_mokojoomtos.ini
@@ -13,7 +13,10 @@ PLG_SYSTEM_MOKOJOOMTOS_FIELD_TOS_SLUG_DESC="Enter the menu slug for your Terms o
; Help
PLG_SYSTEM_MOKOJOOMTOS_HELP_LABEL="How to Use This Plugin"
-PLG_SYSTEM_MOKOJOOMTOS_HELP_DESC="Step 1: Create a Joomla article for your Terms of Service.
Step 2: Create a menu item pointing to that article.
Step 3: Set the menu item alias/slug (e.g., 'terms-of-service').
Step 4: Enter that same slug above.
Step 5: When your site goes offline, visitors can still access your-site.com/terms-of-service"
+PLG_SYSTEM_MOKOJOOMTOS_HELP_DESC="Step 1: Create a Joomla article for your Terms of Service.
Step 2: Create a menu item pointing to that article.
Step 3: Set the menu item alias/slug (e.g., 'terms-of-service').
Step 4: Enter that same slug above.
Step 5: When your site goes offline, visitors can still access yoursite.com/terms-of-service"
+
+; Errors
+PLG_SYSTEM_MOKOJOOMTOS_ERROR_LOADING_MENU_ITEMS="Error loading menu items: %s"
; Installation messages
PLG_SYSTEM_MOKOJOOMTOS_INSTALL_SUCCESS="MokoJoomTOS Plugin installed successfully!"
diff --git a/src/language/en-GB/plg_system_mokojoomtos.ini b/src/language/en-GB/plg_system_mokojoomtos.ini
index 8c10471..736f3a6 100644
--- a/src/language/en-GB/plg_system_mokojoomtos.ini
+++ b/src/language/en-GB/plg_system_mokojoomtos.ini
@@ -15,6 +15,9 @@ PLG_SYSTEM_MOKOJOOMTOS_FIELD_TOS_SLUG_DESC="Enter the menu slug for your Terms o
PLG_SYSTEM_MOKOJOOMTOS_HELP_LABEL="How to Use This Plugin"
PLG_SYSTEM_MOKOJOOMTOS_HELP_DESC="Step 1: Create a Joomla article for your Terms of Service.
Step 2: Create a menu item pointing to that article.
Step 3: Set the menu item alias/slug (e.g., 'terms-of-service').
Step 4: Enter that same slug above.
Step 5: When your site goes offline, visitors can still access yoursite.com/terms-of-service"
+; Errors
+PLG_SYSTEM_MOKOJOOMTOS_ERROR_LOADING_MENU_ITEMS="Error loading menu items: %s"
+
; Installation messages
PLG_SYSTEM_MOKOJOOMTOS_INSTALL_SUCCESS="MokoJoomTOS Plugin installed successfully!"
PLG_SYSTEM_MOKOJOOMTOS_UPDATE_SUCCESS="MokoJoomTOS Plugin updated successfully!"
diff --git a/src/language/en-US/plg_system_mokojoomtos.ini b/src/language/en-US/plg_system_mokojoomtos.ini
index 8c10471..736f3a6 100644
--- a/src/language/en-US/plg_system_mokojoomtos.ini
+++ b/src/language/en-US/plg_system_mokojoomtos.ini
@@ -15,6 +15,9 @@ PLG_SYSTEM_MOKOJOOMTOS_FIELD_TOS_SLUG_DESC="Enter the menu slug for your Terms o
PLG_SYSTEM_MOKOJOOMTOS_HELP_LABEL="How to Use This Plugin"
PLG_SYSTEM_MOKOJOOMTOS_HELP_DESC="Step 1: Create a Joomla article for your Terms of Service.
Step 2: Create a menu item pointing to that article.
Step 3: Set the menu item alias/slug (e.g., 'terms-of-service').
Step 4: Enter that same slug above.
Step 5: When your site goes offline, visitors can still access yoursite.com/terms-of-service"
+; Errors
+PLG_SYSTEM_MOKOJOOMTOS_ERROR_LOADING_MENU_ITEMS="Error loading menu items: %s"
+
; Installation messages
PLG_SYSTEM_MOKOJOOMTOS_INSTALL_SUCCESS="MokoJoomTOS Plugin installed successfully!"
PLG_SYSTEM_MOKOJOOMTOS_UPDATE_SUCCESS="MokoJoomTOS Plugin updated successfully!"
diff --git a/src/mokojoomtos.xml b/src/mokojoomtos.xml
index b488ce0..66b5741 100644
--- a/src/mokojoomtos.xml
+++ b/src/mokojoomtos.xml
@@ -84,8 +84,6 @@
Welcome to our Terms of Service page.
This page will remain accessible even when the site is in offline/maintenance mode.
', 'fulltext' => '', 'state' => 1, - 'catid' => 2, // Uncategorised + 'catid' => $catId, 'created' => Factory::getDate()->toSql(), - 'created_by' => 0, // System-created content + 'created_by' => $createdBy, 'language' => '*', 'access' => 1, // Public ]; @@ -227,7 +247,7 @@ class PlgSystemMokojoomtosOfflineInstallerScript extends InstallerScript echo '✓ Created Terms of Service article
'; return $table->id; - } catch (Exception $e) { + } catch (\Exception $e) { Log::add('Error creating Terms of Service article: ' . $e->getMessage(), Log::WARNING, 'jerror'); } @@ -268,7 +288,12 @@ class PlgSystemMokojoomtosOfflineInstallerScript extends InstallerScript ->where($db->quoteName('type') . ' = ' . $db->quote('component')) ->where($db->quoteName('element') . ' = ' . $db->quote('com_content')); $db->setQuery($query); - $componentId = (int) $db->loadResult() ?: 22; // Fallback to 22 if query fails + $componentId = (int) $db->loadResult(); + + if (!$componentId) { + Log::add('Could not determine com_content component ID', Log::WARNING, 'jerror'); + return; + } Table::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_menus/tables'); $table = Table::getInstance('Menu', 'Joomla\\Component\\Menus\\Administrator\\Table\\'); @@ -318,7 +343,7 @@ class PlgSystemMokojoomtosOfflineInstallerScript extends InstallerScript // Enable the plugin $this->enablePlugin(); - } catch (Exception $e) { + } catch (\Exception $e) { Log::add('Error creating Terms of Service menu item: ' . $e->getMessage(), Log::WARNING, 'jerror'); } } @@ -348,7 +373,7 @@ class PlgSystemMokojoomtosOfflineInstallerScript extends InstallerScript $db->execute(); echo '✓ Created Legal menu type
'; - } catch (Exception $e) { + } catch (\Exception $e) { Log::add('Error creating Legal menu type: ' . $e->getMessage(), Log::WARNING, 'jerror'); } } @@ -374,7 +399,7 @@ class PlgSystemMokojoomtosOfflineInstallerScript extends InstallerScript $db->execute(); echo '✓ Plugin enabled automatically
'; - } catch (Exception $e) { + } catch (\Exception $e) { Log::add('Error enabling plugin: ' . $e->getMessage(), Log::WARNING, 'jerror'); } }