Unit/System Tests PR-6.2-dev Pending

User tests: Successful: Unsuccessful:

avatar rish106-hub
rish106-hub
24 Jun 2026

Problem

When a user/author is deleted in Joomla, their articles retain the original `created_by` ID which becomes orphaned (or 0). Opening such an article in the admin shows an empty/invalid author field. Saving the article preserves the broken state.

Solution

  • ArticleModel.php — In `save()`, before delegating to `parent::save()`, validate `created_by`: if it is 0/empty or refers to a deleted user (DB check), auto-assign the current logged-in user's ID.
  • Content.php — In `store()`, change the existing-article fallback for empty `created_by` from `0` to `$user->id` as a safety net for CLI/batch code that bypasses the model.

Testing Instructions

  1. Delete a Joomla user who authored articles.
  2. Open one of their orphaned articles in the admin editor — author field shows empty/invalid.
  3. Save → verify `created_by` is now the current admin's ID (check article Info tab or DB).
  4. Verify saving a normal article with a valid author leaves `created_by` unchanged.

Automated Cypress spec

```bash
npm run cypress:run -- --spec "tests/System/integration/administrator/components/com_content/ArticleOrphanedAuthor.cy.js"
```

Environment

  • PHP: 8.3+
  • Database: MySQL/MariaDB/PostgreSQL
  • Branch: 6.2-dev

Fixes #47995

avatar rish106-hub rish106-hub - open - 24 Jun 2026
avatar rish106-hub rish106-hub - change - 24 Jun 2026
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 24 Jun 2026
Category Administration com_content Libraries JavaScript Unit Tests
avatar brianteeman
brianteeman - comment - 24 Jun 2026

Is this really the best option. It is explicitly just for articles but the same problem can occur right across joomla

avatar rish106-hub rish106-hub - change - 24 Jun 2026
Labels Added: Unit/System Tests PR-6.2-dev
avatar rish106-hub
rish106-hub - comment - 24 Jun 2026

@brianteeman - valid point, and appreciated.

The orphaned created_by problem can technically affect any component with that column. However, expanding this fix to AdminModel::save() now would touch the most-used base class across all of Joomla and would require considerably broader testing and review across every component.

This PR is intentionally scoped to com_content to:

  • Stay focused on the filed issue (#47995)
  • Limit regression risk (already covered by a Cypress spec with three cases)
  • Give maintainers a small, reviewable change

Happy to file a follow-up issue to track the broader fix for other components if that would help. If the consensus is that this should be fixed in the base class in this PR, I can attempt that - just flagging the expanded risk/testing scope.

Add a Comment

Login with GitHub to post a comment