Joomla content events in plugin - do not seem to work

For Joomla! 2.5 Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general
Note: All 1.6, 1.7 and 3.5 releases have reached end of life and should be updated to 3.x.

Moderator: ooffick

Forum rules
Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.
Locked
MichaelaW
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Thu May 29, 2014 2:33 pm

Joomla content events in plugin - do not seem to work

Post by MichaelaW » Thu May 29, 2014 5:18 pm

Hi,

I am developing a content-based plugin fro Joomla 2.5.17 . I don't know why, but it seems to me that the events like onContentBeforeSave or even onContentBeforeDisplay are not called properly at my website.

Here is the code of my plugin. No errors, but nothing really happens:

Code: Select all

<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport('joomla.plugin.plugin');

class plgContentImage extends JPlugin
{

/**
 * Constructor - note in Joomla 2.5 PHP4.x is no longer supported so we can use this.
 *
 * @access      protected
 * @param       object  $subject The object to observe
 * @param       array   $config  An array that holds the plugin configuration
 */
public function __construct(& $subject, $config)
{
        parent::__construct($subject, $config);
}

/**
 * Plugin method with the same name as the event will be called automatically.
 */
public function onContentBeforeDisplay($context, &$row, &$params, $limitstart)
{   
    return "<div>OnContentBeforeDisplay</div>";
} 
 
function onContentBeforeSave($context, &$article, $isNew)
 {
    $app = JFactory::getApplication();
    global $mainframe;
    
if ( $context == "com_content.article" ) {   
    $article->fulltext = "AAA";
    echo "test";
  }  
    return true;

 }
 
}
?>
Any idea, what could be wrong here?
Thanks in advance for any help.

User avatar
b2z
Joomla! Intern
Joomla! Intern
Posts: 69
Joined: Sat Apr 19, 2014 5:10 am
Location: Riga, Latvia
Contact:

Re: Joomla content events in plugin - do not seem to work

Post by b2z » Mon Jun 02, 2014 1:19 pm

Have you tried it on default template?

iextensions
I've been banned!
Posts: 1498
Joined: Fri Jul 12, 2013 5:37 pm
Contact:

Re: Joomla content events in plugin - do not seem to work

Post by iextensions » Thu Jul 24, 2014 4:10 am

please check the plugin and it runs that function or not?
Zip and send plugin here, we can look?


Locked

Return to “Joomla! 2.5 Coding”