EVENT-SUBSCRIBER-001

function onContentPrepare(...)

JPlugin onX methods vs SubscriberInterface

Method-name events still fire, but Joomla 4+ wants subscribers with typed Event objects. Native Joomla 6 quality means SubscriberInterface, not a JPlugin with onContentPrepare by convention.

function onContentPrepare(...)CMSPlugin + SubscriberInterface::getSubscribedEvents()

Dies at Joomla 5 → 6J3: Works nativelyJ4: Changed behaviourJ6: Changed behaviourBC plugin: partialArchitecture change — no auto-fixEvents / plugins

Symptoms people search

plugin does not run on Joomla 6 · onContentPrepare never called

Replace this code

Swap function onContentPrepare(...) for CMSPlugin + SubscriberInterface::getSubscribedEvents().

Joomla 3

Remove or stop calling this

class PlgContentLms extends JPlugin {
    public function onContentPrepare($context, &$article, &$params, $page = 0) {}
}

Joomla 4 / 6

Use this instead

class Lms extends CMSPlugin implements SubscriberInterface {
    public static function getSubscribedEvents(): array {
        return ['onContentPrepare' => 'prepare'];
    }
    public function prepare(Event $event): void {}
}

How to fix it

  1. 1Extend CMSPlugin and implement SubscriberInterface.
  2. 2Map event names in getSubscribedEvents().
  3. 3Read arguments from the Event object, not &$article by reference.

Also known as

SubscriberInterface · onContentPrepare · onAfterRender · JPlugin

There is no 1:1 swap for this one. The architecture changed. If you cannot rewrite it, Infyways can.

Related issues

Get in touch

Have a project in mind? Let's talk about it.

Tell us what you're building. Whether it's a new site, an online store, a mobile app, or something that needs AI under the hood, we'll get back to you within a business day.

Free consultation
No commitment, no pressure
Reply within 24 hours
Usually much faster

Prefer a direct conversation?

Request a project quote

Tell us about your project

Fill out the quick form and we'll reach out.