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


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"&...


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


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


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

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; }


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) { ...


1

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 to check that context is com.media.file, e.g.: public function onContentAfterSave($context, $item, $isNew) { if ($context !== 'com_media.file') { ...


1

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 wildcard characters in the value to follow LIKE. Since your intention is probably to make an exact match, it is better programming to use = instead of LIKE. For that ...


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