bug: plugin non-functional when SEF URLs are disabled #91

Closed
opened 2026-05-22 03:29:25 +00:00 by jmiller · 1 comment
Owner

Description

The slug matching logic in MokoJoomTOS.php operates on Uri::getInstance()->getPath(), which returns the SEF path (e.g., /terms-of-service). When SEF URLs are disabled, Joomla serves requests as index.php?option=com_content&view=article&id=1, making the path just index.php -- which will never match any configured slug.

Impact

The plugin silently fails when SEF is disabled. Legal pages are inaccessible during offline mode.

Fix

Add a fallback check using Joomla input parameters (e.g., Itemid against menu item IDs for configured slugs) when SEF is disabled.

Files

  • src/src/Extension/MokoJoomTOS.php:95-128 - slug matching logic
  • src/mokojoomtos.php:79-112 - legacy duplicate (dead code under Joomla 5)
## Description The slug matching logic in `MokoJoomTOS.php` operates on `Uri::getInstance()->getPath()`, which returns the SEF path (e.g., `/terms-of-service`). When SEF URLs are disabled, Joomla serves requests as `index.php?option=com_content&view=article&id=1`, making the path just `index.php` -- which will never match any configured slug. ## Impact The plugin silently fails when SEF is disabled. Legal pages are inaccessible during offline mode. ## Fix Add a fallback check using Joomla input parameters (e.g., `Itemid` against menu item IDs for configured slugs) when SEF is disabled. ## Files - `src/src/Extension/MokoJoomTOS.php:95-128` - slug matching logic - `src/mokojoomtos.php:79-112` - legacy duplicate (dead code under Joomla 5)
jmiller added the joomlapriority: criticalbug labels 2026-05-22 03:29:25 +00:00
Author
Owner

Testing Steps -- Non-SEF URL fallback

Setup

  1. Install the plugin on a Joomla 5.x site
  2. Configure the plugin with slug terms-of-service
  3. Verify the Terms of Service article and menu item exist

Test A: SEF enabled (baseline)

  1. Go to System > Global Configuration > SEO -- ensure Search Engine Friendly URLs = Yes
  2. Set Site Offline = Yes
  3. In an incognito browser, visit yoursite.com/terms-of-service
  4. Expected: Article content displays (no template chrome)

Test B: SEF disabled (the fix)

  1. Go to System > Global Configuration > SEO -- set Search Engine Friendly URLs = No
  2. Set Site Offline = Yes
  3. Find the menu item ID for Terms of Service (check in Menus > Legal)
  4. In an incognito browser, visit yoursite.com/index.php?Itemid=XX (replace XX with the menu item ID)
  5. Expected: Article content displays (no template chrome)
  6. Visit yoursite.com/index.php?Itemid=999 (non-matching ID)
  7. Expected: Offline page is shown

Test C: SEF disabled, no Itemid

  1. With SEF off and site offline, visit yoursite.com/index.php
  2. Expected: Offline page is shown (no bypass without valid Itemid)

Pass criteria

  • SEF enabled: slug matching works as before
  • SEF disabled: Itemid-based matching bypasses offline mode
  • SEF disabled: non-matching Itemid shows offline page
  • SEF disabled: no Itemid shows offline page
## Testing Steps -- Non-SEF URL fallback ### Setup 1. Install the plugin on a Joomla 5.x site 2. Configure the plugin with slug `terms-of-service` 3. Verify the Terms of Service article and menu item exist ### Test A: SEF enabled (baseline) 1. Go to **System > Global Configuration > SEO** -- ensure **Search Engine Friendly URLs = Yes** 2. Set **Site Offline = Yes** 3. In an incognito browser, visit `yoursite.com/terms-of-service` 4. **Expected:** Article content displays (no template chrome) ### Test B: SEF disabled (the fix) 1. Go to **System > Global Configuration > SEO** -- set **Search Engine Friendly URLs = No** 2. Set **Site Offline = Yes** 3. Find the menu item ID for Terms of Service (check in **Menus > Legal**) 4. In an incognito browser, visit `yoursite.com/index.php?Itemid=XX` (replace XX with the menu item ID) 5. **Expected:** Article content displays (no template chrome) 6. Visit `yoursite.com/index.php?Itemid=999` (non-matching ID) 7. **Expected:** Offline page is shown ### Test C: SEF disabled, no Itemid 1. With SEF off and site offline, visit `yoursite.com/index.php` 2. **Expected:** Offline page is shown (no bypass without valid Itemid) ### Pass criteria - [ ] SEF enabled: slug matching works as before - [ ] SEF disabled: Itemid-based matching bypasses offline mode - [ ] SEF disabled: non-matching Itemid shows offline page - [ ] SEF disabled: no Itemid shows offline page
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoJoomTOS#91