Skip to main content
6 votes
Accepted

Trigger event for specific plugin only

Generally, an event dispatcher does not support this concept. You're better off directly calling that single function versus going through a dispatcher if you really only want one response from one ...
Michael's user avatar
  • 1,620
5 votes

Content plugin doesn't add text to articles

Your plugin appears to be written for a very old version of Joomla! The event in current versions is onContentBeforeSave. You are also missing $context argument. It's a good idea to check for context ...
Sharky's user avatar
  • 11.5k
5 votes
Accepted

Why is my plugin not hooking into events?

Plugin class name must match the plugin name defined in manifest file. If you have this in the manifest: <filename plugin="installer_log">installer_log.php</filename> Then class name ...
Sharky's user avatar
  • 11.5k
5 votes
Accepted

Is there an event like "OnAfterCompileHead"?

I have to edit my answer, as I think I didn't get right what you are actually want initially. With all the 3 events you can do changes on the head. If you have other plugins that do the same, then you ...
FFrewin's user avatar
  • 19.7k
4 votes
Accepted

Simple Joomla plugin doesn't work

The naming convention of the plugin files must be proper. This might be the issue why your plugin class is not rendering. See the example below: Plugin File: nameofplugin.php class ...
Liz.'s user avatar
  • 1,385
3 votes

Limiting onContentAfterSave to one result

I am reading your code and I think it makes no sense... I can see only problems in your question, the code and in the approach for what I assume you want to achieve. I will try to translate what ...
FFrewin's user avatar
  • 19.7k
3 votes
Accepted

Is there an event for saving a menu item?

onContentAfterSave() is the right one. It appears in com_menus, in the menu item model's save function: (administrator\components\com_menus\models\menu.php - line 240) // Trigger the after save ...
RichardB's user avatar
  • 3,082
3 votes
Accepted

How is onContentAfterSave working in the Front End?

com_content frontend form model extends the backend model which in turn extends Joomla\CMS\MVC\Model\AdminModel. The backend model has a custom save() method where the event is triggered. Meanwhile, ...
Sharky's user avatar
  • 11.5k
3 votes
Accepted

native voting for events of events booking plugin

One way you could perhaps achieve this is to use the content plugins that come with Events Booking to insert category and event details into articles and then use the native article rating system on ...
Neil Robertson's user avatar
3 votes

Logout within plugin interfering with other plugins

The Joomla plugins run as they are ordered in the Joomla backend. Change the ordering - and ensure that the ordering of your plugin is last. This will ensure that all other plugins will run before ...
itoctopus's user avatar
  • 3,226
3 votes
Accepted

onUserAfterLogin popup - Joomla 3.6.4 Plugin

The return value of onUserAfterLogin() should be a boolean -- ie true or false. The idea is that you can use this event handler to do additional validation on the login, so if you return false, it ...
Simba's user avatar
  • 610
3 votes
Accepted

How to programmatically set the value of a custom field of type checkbox?

Basically you needed to use onContentAfterSave rather then onContentBeforeSave and use the FieldsHelper in conjuction with the FieldsModelField. Here is the code: <?php defined( '_JEXEC' ) or die(...
mralexandrelise's user avatar
3 votes

Register Plugin/Class Joomla

As mentioned in the comments, normally you should not use plugin objects directly. But if you need it for some reason, the correct way is using Joomla\CMS\Extension\ExtensionManagerInterface::...
Sharky's user avatar
  • 11.5k
2 votes

Event for saving Custom Fields data? Or before save

You can use the onContentBeforeSave and the onContentAfterSave event and filter your functions with the proper $context for the com_fields, so it will run only when you are in com_fields.
FFrewin's user avatar
  • 19.7k
2 votes
Accepted

How does Joomla! event system (plugins) avoid namespace conflicts?

If you want to understand more how Joomla! plugins work I recommend you to read this awesome book from an advanced Joomla! developer Jisse Reitsma. In Joomla! All plugins are triggered by groups in a ...
mralexandrelise's user avatar
2 votes
Accepted

Updating JEventDispatcher triggers

use Joomla\CMS\Factory; Factory::getApplication()->triggerEvent('onBeforeRenderToolbar', array($settings)); This method can be used in 3.x too.
Sharky's user avatar
  • 11.5k
2 votes

How to use plugin content-events on featured contacts page

I did some research and found a solution using template overrides (thanks to Sharky answer). You can manually trigger content plugins in template overrides for featured contacts as well. Default ...
sbruemmer's user avatar
2 votes

Limiting onContentAfterSave to one result

You could use this sample of code to have a peek at what is available from the data being passed to onContentAfterSave public function onContentAfterSave ($context, $article, $isNew) { ...
Irata's user avatar
  • 3,972
2 votes
Accepted

How to add an error message when returning false in the onContentBeforeSave event?

You can throw an Exception: if ($date > $now) { throw new RuntimeException(JText::_('PLG_CONTENT_MYPLUGIN_SOME_ERROR')); } Or use setError() on the table object: if ($date > $now) { $...
Sharky's user avatar
  • 11.5k
2 votes
Accepted

Can plugins listen to events in different groups?

Yes, as long as the plugin is instantiated. This is done when the plugin group is imported. The common way is to create a plugin in system group because those are always imported. Beware that plugin ...
Sharky's user avatar
  • 11.5k
2 votes
Accepted

Plugin for two types of events from different plugin types

Joomla's System Plugins are triggered with every page request. Although you can use them for everything, for performance it's better to limit its use. In some cases you could prefer to use non-system ...
pe7er's user avatar
  • 2,058
2 votes
Accepted

How to access the plugin event in Joomla 4

The problem is that most likely all events should start with "on" when a different prefix is specified, as in my case the "get" event simply does not fire. I changed the prefix to &...
MaXX's user avatar
  • 181
2 votes
Accepted

Register Plugin/Class Joomla

For having and working with a plugin in a module of Joomla directly (not via events), for testing this let's say you have your own plugin group called: 'myplug' and your plugin is called: 'testplugin1'...
Zollie's user avatar
  • 2,946
1 vote

Listening for a "image upload" event

Does such an event exist? Core com_media component uses the same events as other core components: onContentBeforeSave, onContentAfterSave, onContentBeforeDelete and onContentAfterDelete. You'll need ...
Sharky's user avatar
  • 11.5k
1 vote

Limiting onContentAfterSave to one result

There may be multiple issues to correct with your snippet, but I can confidently point out a couple things... (title LIKE '$article_title') This is seeking an exact match because there are no ...
mickmackusa's user avatar
  • 4,826
1 vote
Accepted

Develop a System Plugin with Sample Data for Options

I am not sure there is not a simpler way. But this way you'll get what you want. a) Create a custom field to implement your logic. You can extend from any basic custom field types. b) Simply set it ...
Riccardo Zorn's user avatar
1 vote
Accepted

How to remove specific articles from blog view using a plugin custom code. Its possible? How?

AFAIK, and you can look in the code, there is no plugin triggerer in getListQuery statement. So basically you can not. But there is 2 workarounds (not pretty really): strip not needed block in ...
Alexandr's user avatar
  • 1,130
1 vote
Accepted

search component/plugin in joomla

Override/Change the return values of the getIgnoredSearchWords() and getLowerLimitSearchWord() in /language/en-GB/en-GB.localise.php (and any other /language/<lang>/<lang>.localise.php ...
Drew G's user avatar
  • 890
1 vote

How to control the execution order of the same event?

Just order the plugins in plugins manager in the same way you want them to execute. However, it is best practice to keep the even triggers execute in an independent way.
Nagarjun's user avatar
  • 3,001
1 vote

onAfterModuleList not triggered in Home or in Wrapper menu type?

With this code all the modules are listed at each menuitem incl. home public function onAfterModuleList(&$modules) { foreach ($modules as $module) { echo '<pre>'; echo $...
COBIZ webdevelopment's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible