Content plugin ignores language when loading/saving OG data (multilingual bug) #41

Open
opened 2026-05-31 01:19:00 +00:00 by jmiller · 1 comment
Owner

Problem

MokoOGContent::loadOgData() queries by content_type + content_id only, with no language filter:

->where($db->quoteName('content_type') . ' = ' . $db->quote($contentType))
->where($db->quoteName('content_id') . ' = ' . $contentId);

But the DB schema has a unique key on (content_type, content_id, language), and the system plugin correctly filters by language.

Impact

On multilingual sites:

  • Editor always loads the first record regardless of editing language
  • Saving overwrites whichever record was loaded, corrupting other languages' OG data
  • Cannot set different OG titles/descriptions per language

Fix

  • Add language filter to loadOgData() matching current editing language
  • Include language in saveOgData() upsert logic
  • Pass language through the form data

Files

  • src/packages/plg_content_mokoog/src/Extension/MokoOGContent.php:189-203 (load)
  • src/packages/plg_content_mokoog/src/Extension/MokoOGContent.php:215-257 (save)
## Problem `MokoOGContent::loadOgData()` queries by `content_type` + `content_id` only, with **no language filter**: ```php ->where($db->quoteName('content_type') . ' = ' . $db->quote($contentType)) ->where($db->quoteName('content_id') . ' = ' . $contentId); ``` But the DB schema has a unique key on `(content_type, content_id, language)`, and the system plugin correctly filters by language. ## Impact On multilingual sites: - Editor always loads the first record regardless of editing language - Saving overwrites whichever record was loaded, corrupting other languages' OG data - Cannot set different OG titles/descriptions per language ## Fix - Add language filter to `loadOgData()` matching current editing language - Include language in `saveOgData()` upsert logic - Pass language through the form data ## Files - `src/packages/plg_content_mokoog/src/Extension/MokoOGContent.php:189-203` (load) - `src/packages/plg_content_mokoog/src/Extension/MokoOGContent.php:215-257` (save)
jmiller added the priority: highbugproduction-readiness labels 2026-05-31 01:19:00 +00:00
Author
Owner

Branch created: feature/41-content-plugin-ignores-language-when-loa

git fetch origin
git checkout feature/41-content-plugin-ignores-language-when-loa
Branch created: [`feature/41-content-plugin-ignores-language-when-loa`](https://git.mokoconsulting.tech/MokoConsulting/MokoJoomOpenGraph/src/branch/feature/41-content-plugin-ignores-language-when-loa) ```bash git fetch origin git checkout feature/41-content-plugin-ignores-language-when-loa ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoJoomOpenGraph#41