6

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 location. Joomla 4.0 will use the refactored Event package as its base for event management, and the EventInterface contains a stopPropagation() method which a ...


5

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 can re-order them. onAfterDispatch onBeforeRender onBeforeCompileHead To edit the <head> data: The head is stored in the document object and you ...


5

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 should be PlgExtensionInstaller_Log. Other way around, if class is PlgExtensionLogInstall, then manifest should contain this: <filename plugin="loginstall"&...


5

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 to make sure that you're modifying the correct content type (e.g. article). public function onContentBeforeSave($context, $article, $isNew) { if ($context !...


4

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 plgContentNameofplugin extends JPlugin { //plugin code } XML File: nameofplugin.xml <files> <filename plugin="nameofplugin">nameofplugin.php</filename> &...


3

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 indicates that the login should be rejected. What you want to do is quite different; you're trying to add content to the page after login. There's several ways of ...


3

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 yours.


3

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 event. $dispatcher->trigger('onContentAfterSave', array($this->_context, &$table, $isNew)); I ran a hello world test by adding a die("hello world") to ...


3

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, your frontend form model extends Joomla\CMS\MVC\Model\FormModel which has no such event and no save() method. The simplest solution would be to trigger the ...


3

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 your code will be doing if you enable your plugin: You will be running what you have there in every content load, for as many content items you will be loading ...


2

If you are testing on save, then echo'ing out something may never be seen as almost certainly a redirect is triggered after the save. So try adding an exit; to double check that it really isn't firing : class plgContentTest extends JPlugin { /** * Loads the application object * * @var JApplicationCms * @since 3.2 */ ...


2

Check following things: Plugin class name should be: plgContentTest Plugin class should extend JPlugin class Plugin filename should be: test.php Plugin file should be in: /plugins/content/test Plugin xml definition filename should be: test.xml Plugin xml definition file should be in: /plugins/content/test Plugin should be installed and enabled Few other ...


2

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 given order based by their ordering in the plugin administration page of the Joomla! backend. If a plugin within a group "A" sends some "garbage input" as you ...


2

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 the articles. EB Event Plugin "This plugin is used to display event detail within a Joomla article" {ebevent EVENT_ID} Eventbooking Category Content Plugin "...


2

use Joomla\CMS\Factory; Factory::getApplication()->triggerEvent('onBeforeRenderToolbar', array($settings)); This method can be used in 3.x too.


2

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) { echo "<pre> Context ......."; print_r($context);"</pre>"; echo "<pre> Article ......."; print_r($article);"</pre>"; ...


2

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( 'Restricted access' ); class plgContentAlertcustomfieldhandler extends JPlugin { public function onContentAfterSave($context, &$article, $isNew) { ...


2

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) { $article->setError(JText::_('PLG_CONTENT_MYPLUGIN_SOME_ERROR')); return false; }


1

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 manually to default to 0 (the attribute default="0" is accepted in most form types). This will not set the value until the user actually saves the preferences; ...


1

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 file of active languages).


1

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.


1

With this code all the modules are listed at each menuitem incl. home public function onAfterModuleList(&$modules) { foreach ($modules as $module) { echo '<pre>'; echo $module->title; echo '</pre>'; } return true; } I placed this method in a custom system plugin.


1

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.


1

A list of all the events specific to the fields: onCustomFieldsBeforePrepareField onCustomFieldsPrepareField onCustomFieldsAfterPrepareField onCustomFieldsPrepareDom onCustomFieldsGetTypes Since the fields component does not have its own specific "Before Save" and "After Save" events, then the onContentBeforeSave and the onContentAfterSave events will be ...


1

OK, I finally got it to work looking through this page again. To display one of the default fields I just had to enter renderField('name_of_field'), but to display one of the custom fields I have to add a second parameter, which is the group name of the fields. In my case I kept the group name the same as the sample plugin--profile. So I had to enter ...


1

It seems that someone from the core team read your post, and, as such, added a condition to check if the user plugin is enabled, and if it is, then they get the plugin parameters. In essence, the developer changed this code: $plugin = JPluginHelper::getPlugin('user', 'joomla'); $pluginParams = new Registry($plugin->params); to: $pluginParams = new ...


1

onContentAfterDisplay isn't called at a point when the full getBody() content has been generated. It is rather called at the points where components and modules are generating their individual views. As such, JFactory::getApplication()->getBody() content will not exist at the time you are calling it. Try the following to see which content it is ...


1

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 onBeforeRender at system plugins; and the really weird one: after system is initialized replace (override, load instead of) content model with your own one that will ...


1

The update server definition is not loaded to the database until the onExtensionAfterInstall event is dispatched, and this depends on the "Extension - Joomla" plugin being enabled.


1

Well, "checkData is not defined" isn't your only problem. Your page by the time of loading produces js errors. Also, when you focus in your input field there is one more error. By the way, submitting in your form, it goes on -while trying to enter a number higher than 10, it reports back the restriction that I can only register up to 10 persons. I didn't ...


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