Plugin onAfterRender not called in last

This forum is for general questions about extensions for Joomla! 3.x.

Moderators: pe7er, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
losewin
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Thu Nov 14, 2019 8:43 am

Plugin onAfterRender not called in last

Post by losewin » Thu Nov 14, 2019 8:46 am

Hi guys, is there a way to make plugin be called in last? or its event of

Code: Select all

onAfterRender
is there a tweak or settings to be configure?

waarnemer
Joomla! Hero
Joomla! Hero
Posts: 2685
Joined: Sun May 04, 2008 12:37 pm

Re: Plugin onAfterRender not called in last

Post by waarnemer » Thu Nov 14, 2019 9:04 am

If you need a plugin to be the last one called, you can change its order of execution...
in admin go to plugins and open your plugin on the right you will find ordering.
the dropdown at the bottom will show "order last".

losewin
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Thu Nov 14, 2019 8:43 am

Re: Plugin onAfterRender not called in last

Post by losewin » Fri Nov 15, 2019 1:23 am

I tried it but still it won't work, there is a plugin which is ahead on my plugin, don't know why.

losewin
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Thu Nov 14, 2019 8:43 am

Re: Plugin onAfterRender not called in last

Post by losewin » Fri Nov 15, 2019 6:19 am

I debug the process of the plugin, The ordering system is working but the event sequence is not on the right track

Code: Select all

Other Plugin __construct ()Custom Plugin __construct ()Custom Plugin onAfterRender ()Other Plugin onAfterRender ()
So basically the

Code: Select all

Custom Plugin onAfterRender ()
event is being trigger instead of being next to

Code: Select all

Other Plugin onAfterRender ()

losewin
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Thu Nov 14, 2019 8:43 am

Re: Plugin onAfterRender not called in last

Post by losewin » Fri Nov 15, 2019 6:25 am

Wew, finally got the right thing, I don't know why I hope someone can explain but adding

Code: Select all

/**
	 * [onAfterInitialise description]
	 * @return [type] [description]
	 */
	public function onAfterInitialise()
	{
		$dispatcher = JEventDispatcher::getInstance();
		$dispatcher->detach($this);
		$dispatcher->attach($this);
	} 

	/**
	 * [onBeforeRender description]
	 * @return [type] [description]
	 */
	public function onBeforeRender()
	{
		$dispatcher = JEventDispatcher::getInstance();
		$dispatcher->detach($this);
		$dispatcher->attach($this);
	}
Fixes the issue

SharkyKZ
Joomla! Ace
Joomla! Ace
Posts: 1658
Joined: Fri Jul 05, 2013 10:35 am
Location: Parts Unknown

Re: Plugin onAfterRender not called in last

Post by SharkyKZ » Fri Nov 15, 2019 6:26 am

What type (folder/group) does your plugin and the other plugin belong to?


Post Reply

Return to “Extensions for Joomla! 3.x”