Plugin issue with JDispatcher::Register event

For Joomla! 1.5 Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general
daniel.rataj
Joomla! Apprentice
Joomla! Apprentice
Posts: 19
Joined: Fri Dec 08, 2006 9:58 am

Plugin issue with JDispatcher::Register event

Post by daniel.rataj » Wed Apr 02, 2008 5:28 am

Hi, I've problem with notice "JDispatcher::register: Event handler not recognized." in my plugins.
If I try to install on a fresh Joomla! 1.5.2 installation, it seems all is working. But sometimes wrote to me a users who have this notice on your websites. I don' t know why. I attached an one plugin into this post.

Thanks for your help.

febrone
Joomla! Intern
Joomla! Intern
Posts: 79
Joined: Wed Aug 16, 2006 12:16 pm

Re: Plugin issue with JDispatcher::Register event

Post by febrone » Thu Apr 03, 2008 6:52 pm

I have the same problem....

no solution?
HAI BISOGNO DI AIUTO IN OVERCLOCK E SETTAGGI DEL TUO SISTEMA??
VISITA IL NUOVO SITO E FORUM DI : ---> [url=http://www.xtremehardware.it]WWW.xtremehardware.IT  <--ARTICOLI E RECENSIONI

supern00b
Joomla! Intern
Joomla! Intern
Posts: 55
Joined: Wed Aug 31, 2005 8:37 pm

Re: Plugin issue with JDispatcher::Register event

Post by supern00b » Sat Apr 05, 2008 12:27 am

EXACT same issue on fresh install of J1.5.

JDispatcher::register: Event handler not recognized.

I only see it when I use front end login. Typically the front page won't load and gives an operation aborted message, but if going to another page I see the JDispatcher message at the top.

Any ideas?

supern00b
Joomla! Intern
Joomla! Intern
Posts: 55
Joined: Wed Aug 31, 2005 8:37 pm

Re: Plugin issue with JDispatcher::Register event

Post by supern00b » Mon Apr 14, 2008 12:02 pm

I STILL have this issue and can't seem to find anything about it.

Did anyone get this resolved?

User avatar
David-Andrew
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 237
Joined: Thu Mar 20, 2008 3:37 pm
Location: The Netherlands
Contact:

Re: Plugin issue with JDispatcher::Register event

Post by David-Andrew » Tue Apr 29, 2008 10:47 am

Also have this issue, cant find a solution...
Awesome Joomla! Extensions by Chill Creations http://www.chillcreations.com
cciDEAL, ccInvoices, ccNewsletter

User avatar
tcp
Joomla! Ace
Joomla! Ace
Posts: 1548
Joined: Wed Sep 21, 2005 9:25 am
Location: Thailand
Contact:

Re: Plugin issue with JDispatcher::Register event

Post by tcp » Wed Apr 30, 2008 4:14 am

This message is coming from line 91 of JDispatcher.

Code: Select all

	function register($event, $handler)
	{
		// Are we dealing with a class or function type handler?
		if (function_exists($handler))
		{
			// Ok, function type event handler... lets attach it.
			$method = array ('event' => $event, 'handler' => $handler);
			$this->attach($method);
		}
		elseif (class_exists($handler))
		{
			 //Ok, class type event handler... lets instantiate and attach it.
			$this->attach(new $handler($this));
		}
		else
		{
			JError::raiseWarning('SOME_ERROR_CODE', 'JDispatcher::register: Event handler not recognized.', 'Handler: '.$handler );
		}
	}
Pretty simple. Whatever you are trying to register does not exist. I would suggest that you check your code and make sure you are passing in the name of a function or a class that exists.

tcp
Your solution for a single-page checkout on any website.
http://moolah-ecommerce.com

daniel.rataj
Joomla! Apprentice
Joomla! Apprentice
Posts: 19
Joined: Fri Dec 08, 2006 9:58 am

Re: Plugin issue with JDispatcher::Register event

Post by daniel.rataj » Wed Apr 30, 2008 1:29 pm

Hi, I understand that the class or function are missing. But I've a code with that:
class = plgContentCdMagicTabs
function = plgContentCdMagicTabs

The class exists and also the function and has the identical name as class. What's wrong?
I attached the part of my plugin. Thanks for any help.
You do not have the required permissions to view the files attached to this post.

User avatar
ianmac
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4784
Joined: Sat Sep 24, 2005 11:01 pm
Location: Toronto, Canada

Re: Plugin issue with JDispatcher::Register event

Post by ianmac » Thu May 01, 2008 1:38 am

If you're using the new plugin framework (which it appears you are since you have a class that extends JPlugin and implements the constructor and the onPrepareContent method, then you don't need to register anything. The plugin gets autoregistered by the Joomla! framework.

Ian

daniel.rataj
Joomla! Apprentice
Joomla! Apprentice
Posts: 19
Joined: Fri Dec 08, 2006 9:58 am

Re: Plugin issue with JDispatcher::Register event

Post by daniel.rataj » Tue May 06, 2008 1:07 pm

Hi,
ianmac wrote:If you're using the new plugin framework (which it appears you are since you have a class that extends JPlugin and implements the constructor and the onPrepareContent method, then you don't need to register anything. The plugin gets autoregistered by the Joomla! framework.
If I don't register with code "$mainframe->registerEvent" , the plugin isn't processed.

Note: I tried to install the PHP eAccelerator and now the message "JDispatcher::Register event" is displayed!

User avatar
ianmac
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4784
Joined: Sat Sep 24, 2005 11:01 pm
Location: Toronto, Canada

Re: Plugin issue with JDispatcher::Register event

Post by ianmac » Tue May 06, 2008 2:04 pm

Would have to see the XML file to figure out what is happening there...

Ian

User avatar
ircmaxell
Joomla! Ace
Joomla! Ace
Posts: 1926
Joined: Thu Nov 10, 2005 3:10 am
Location: New Jersey, USA
Contact:

Re: Plugin issue with JDispatcher::Register event

Post by ircmaxell » Tue May 06, 2008 2:15 pm

daniel.rataj wrote:Hi,
ianmac wrote:If you're using the new plugin framework (which it appears you are since you have a class that extends JPlugin and implements the constructor and the onPrepareContent method, then you don't need to register anything. The plugin gets autoregistered by the Joomla! framework.
If I don't register with code "$mainframe->registerEvent" , the plugin isn't processed.

Note: I tried to install the PHP eAccelerator and now the message "JDispatcher::Register event" is displayed!
Did you name your plugin class acording to the naming convention???

for example
A system plugin, with the name "FooBlah" SHOULD have a class named:
class plgSystemFooBlah extends JPlugin {

Then, you'd need to name your functions for the event you want triggered (for onAfterRender) {
function onAfterRender() {
Anthony Ferrara - Core Team - Development Coordinator - Bug Squad - JSST

http://moovum.com/ - The Bird is in the air! Get Mollom Anti-Spam on your Joomla! website with Moovur...
http://www.joomlaperformance.com For All Your Joomla Performance Needs

daniel.rataj
Joomla! Apprentice
Joomla! Apprentice
Posts: 19
Joined: Fri Dec 08, 2006 9:58 am

Re: Plugin issue with JDispatcher::Register event

Post by daniel.rataj » Tue May 06, 2008 2:26 pm

Sorry for the confusion. I resolved this issue. I noticed the plugin name in database #__plugins is different than the function (class) name.
In example I sent above, the plugin name was "cd_magictabs" in database and the function (class) "plgContentMagicTabs".

Thanks.

User avatar
ianmac
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4784
Joined: Sat Sep 24, 2005 11:01 pm
Location: Toronto, Canada

Re: Plugin issue with JDispatcher::Register event

Post by ianmac » Tue May 06, 2008 2:27 pm

Exactly what I wanted to check...

Check the name attribute in your xml file...

Ian

mjnisbett
Joomla! Apprentice
Joomla! Apprentice
Posts: 38
Joined: Fri Jul 27, 2007 1:29 am

Re: Plugin issue with JDispatcher::Register event

Post by mjnisbett » Thu Jun 05, 2008 4:48 pm

I am having the same issue myself. Can someone help me get to the bottom of it? Thanks!

coolbung
Joomla! Guru
Joomla! Guru
Posts: 552
Joined: Sat Nov 11, 2006 5:03 am
Contact:

Re: Plugin issue with JDispatcher::Register event

Post by coolbung » Thu Jul 16, 2009 12:02 pm

I'm getting this error when people are trying to register. I've upgraded to J1.5.12 (though thats unrelated). Assuming it's not a problem with any of the core plugins how do i find out which of the plugins is the culprit?
Ashwin K. Date - Follow @coolbung @tekdinet @techjoomla @jugpune
Joomla! Extensions & Training - www.techjoomla.com

Jerome123
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 119
Joined: Tue Jan 27, 2009 1:35 pm

Re: Plugin issue with JDispatcher::Register event

Post by Jerome123 » Tue Feb 09, 2010 8:57 am

Hi there,

I have the same JDispatch::register event error.

But the strange thing is that it works on all the website except one. Do you thing it might be a php version affecting it or a setting on the server. I have checked my xml and my class name as well as the constructor are exactly the same.

My plugin start like that:

Code: Select all

$mainframe->registerEvent( 'onAfterDispatch', 'functionname' );

class functionname extends JPlugin{
     function functionname () {

      }

}

Thanks for any help,

Regards,

Jerome

User avatar
ianmac
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4784
Joined: Sat Sep 24, 2005 11:01 pm
Location: Toronto, Canada

Re: Plugin issue with JDispatcher::Register event

Post by ianmac » Tue Feb 09, 2010 3:16 pm

Jerome123 wrote:Hi there,

I have the same JDispatch::register event error.

But the strange thing is that it works on all the website except one. Do you thing it might be a php version affecting it or a setting on the server. I have checked my xml and my class name as well as the constructor are exactly the same.

My plugin start like that:

Code: Select all

$mainframe->registerEvent( 'onAfterDispatch', 'functionname' );

class functionname extends JPlugin{
     function functionname () {

      }

}

Thanks for any help,

Regards,

Jerome
I would try following the example on:
http://docs.joomla.org/Reference:System ... gin_System

Ian

Jerome123
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 119
Joined: Tue Jan 27, 2009 1:35 pm

Re: Plugin issue with JDispatcher::Register event

Post by Jerome123 » Wed Feb 10, 2010 7:01 am

Thanks for the reply but the plugin is working on every website except for 2 of them. Dont you think it is a settings that is missing on their side?

If i try the example from the link you provided me, nothing works, i need to registerEvent.

To get rid of the error for the 2 website i need to remove the class.

Code: Select all

defined( '_JEXEC' ) or die( 'Restricted access' );

$mainframe->registerEvent( 'onAfterDispatch', 'functionname' );

class functionname extends JPlugin {
 
   function functionname(){
      takes the params value
    }

    function onAfterRender(){

    }

etc...

}
As soon as i remove the class for those 2 website then the error message does not appear.

Thanks again for your help.

Regards,

Jerome

User avatar
ianmac
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4784
Joined: Sat Sep 24, 2005 11:01 pm
Location: Toronto, Canada

Re: Plugin issue with JDispatcher::Register event

Post by ianmac » Wed Feb 10, 2010 3:34 pm

Jerome123 wrote:Thanks for the reply but the plugin is working on every website except for 2 of them. Dont you think it is a settings that is missing on their side?

If i try the example from the link you provided me, nothing works, i need to registerEvent.

To get rid of the error for the 2 website i need to remove the class.

Code: Select all

defined( '_JEXEC' ) or die( 'Restricted access' );

$mainframe->registerEvent( 'onAfterDispatch', 'functionname' );

class functionname extends JPlugin {
 
   function functionname(){
      takes the params value
    }

    function onAfterRender(){

    }

etc...

}
As soon as i remove the class for those 2 website then the error message does not appear.

Thanks again for your help.

Regards,

Jerome
You should never need to call registerEvent if your class is named correctly. If you look at all the system plugins included with Joomla you won't see anything in the PHP files except class definitions.

Further, your call to register event looks like:
$mainframe->registerEvent( 'onAfterDispatch', 'functionname' );

Are you defining a function called functionname somewhere else?

Either use JPlugin classes and name your classes properly or use functions. Don't try to mix the two. (i.e. your class should be called plgSystem{PLUGINNAME} and your constructor should take the appropriate parameters).

Ian

Jerome123
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 119
Joined: Tue Jan 27, 2009 1:35 pm

Re: Plugin issue with JDispatcher::Register event

Post by Jerome123 » Wed Feb 10, 2010 3:47 pm

Hey ian,
thanks a lot for the info. Im getting a bit confused here. On a brand new instalation (latest version) the plugin works perfectly,nothing is wrong. but it seems on other version then it breaks.

I have tried to remove $mainframe->registerEvent... but it looks like my class does not get called. Does not seem to go throught the class.

here is my code... My class name is named plgSystem+PluginName
Plus the constructor also have the same name plgSystem+PluginName

below is more info concerning how the plugin and functions works

Code: Select all

defined( '_JEXEC' ) or die( 'Restricted access' );

class plgSystemMyPluginName extends JPlugin {
    
    function plgSystemMyPluginName() {
      This is where i want to get my params and inject my css
    }

    function onAfterRender(){
       use the onAfterRender to call another function which will then return the javascript scripts that needs to be injected into the bottom of the body.
It looks like that i need to use the onAfterRender to be able to use setBody() methods.
    }

    function name($var){
      return the var holding whatever script i need.
    }

}


This is how it works. I dont understand why when i remove the registerEvent then nothing goes thru, is it coming from my class name or constructor???
My class name is case sensitive regarding the plugin name given in the xml

Thanks a lot for your help.

Regards,

Jerome

User avatar
ianmac
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4784
Joined: Sat Sep 24, 2005 11:01 pm
Location: Toronto, Canada

Re: Plugin issue with JDispatcher::Register event

Post by ianmac » Wed Feb 10, 2010 4:35 pm

Jerome123 wrote:Hey ian,
thanks a lot for the info. Im getting a bit confused here. On a brand new instalation (latest version) the plugin works perfectly,nothing is wrong. but it seems on other version then it breaks.
I'm not sure why this is. I'm not sure why it works in the first place. You are installing using the extension installer in both cases?
I have tried to remove $mainframe->registerEvent... but it looks like my class does not get called. Does not seem to go throught the class.
The system can be a bit picky with naming conventions. There are a bunch of things that have to line up:
class name
plugin name:
<name>System - Example</name> that tag and:
<filename plugin="example">example.php</filename> that tag have to match. The stuff inside plugin="" should be lower case (I don't know if it has to be, but that is convention)

So, for this, you have:
jimport('joomla.plugin.plugin');
class plgSystemExample extends JPlugin
...

group="system" is also important, but presumably you have that already.
here is my code... My class name is named plgSystem+PluginName
Plus the constructor also have the same name plgSystem+PluginName

below is more info concerning how the plugin and functions works

Code: Select all

defined( '_JEXEC' ) or die( 'Restricted access' );

class plgSystemMyPluginName extends JPlugin {
    
    function plgSystemMyPluginName() {
      This is where i want to get my params and inject my css
    }
Do you not have any parameters for this method? That could make things PHP version dependent.

Code: Select all

    function onAfterRender(){
       use the onAfterRender to call another function which will then return the javascript scripts that needs to be injected into the bottom of the body.
It looks like that i need to use the onAfterRender to be able to use setBody() methods.
    }

    function name($var){
      return the var holding whatever script i need.
    }

}


This is how it works. I dont understand why when i remove the registerEvent then nothing goes thru, is it coming from my class name or constructor???
My class name is case sensitive regarding the plugin name given in the xml

Thanks a lot for your help.

Regards,

Jerome

Jerome123
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 119
Joined: Tue Jan 27, 2009 1:35 pm

Re: Plugin issue with JDispatcher::Register event

Post by Jerome123 » Wed Feb 10, 2010 4:55 pm

Hey ian,

Yes i use the installer in order to install it.

When i made my changes eg. no registerEvent i didnt rezip it and reinstall it. It might be the prob then.

<name>System - Example</name> Does my xml has to contain System - PluginName??? cuz i dont have it like that. i just have <name>pluginName</name>

Concerning params, yes i do have a few params that must be checked in order to be able to see what script i must inject. Should i get the params in the constructor and or in the onAfterRender and in any other function???

Thanks

User avatar
ianmac
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4784
Joined: Sat Sep 24, 2005 11:01 pm
Location: Toronto, Canada

Re: Plugin issue with JDispatcher::Register event

Post by ianmac » Wed Feb 10, 2010 5:03 pm

Jerome123 wrote:Hey ian,

Yes i use the installer in order to install it.

When i made my changes eg. no registerEvent i didnt rezip it and reinstall it. It might be the prob then.

<name>System - Example</name> Does my xml has to contain System - PluginName??? cuz i dont have it like that. i just have <name>pluginName</name>
I don't know off hand for sure. I don't think so, but I couldn't say for certain.
Concerning params, yes i do have a few params that must be checked in order to be able to see what script i must inject. Should i get the params in the constructor and or in the onAfterRender and in any other function???

Thanks
I was referring to method parameters. So:

Code: Select all

	/**
	 * Constructor
	 *
	 * For php4 compatability we must not use the __constructor as a constructor for plugins
	 * because func_get_args ( void ) returns a copy of all passed arguments NOT references.
	 * This causes problems with cross-referencing necessary for the observer design pattern.
	 *
	 * @access	protected
	 * @param	object	$subject The object to observe
	 * @param 	array   $config  An array that holds the plugin configuration
	 * @since	1.5
	 */
	function plgSystemLog(& $subject, $config) {
		parent::__construct($subject, $config);
	}
do you have &$subject and $config and are you passing them to the constructor?

Ian

Jerome123
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 119
Joined: Tue Jan 27, 2009 1:35 pm

Re: Plugin issue with JDispatcher::Register event

Post by Jerome123 » Thu Feb 11, 2010 6:15 am

No i dont pass any of these params. I must give it a try.
Ill try removing registerEvent and rezip it and reinstall it to see if it works. I might be working on the installation then.

Jerome123
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 119
Joined: Tue Jan 27, 2009 1:35 pm

Re: Plugin issue with JDispatcher::Register event

Post by Jerome123 » Thu Feb 11, 2010 7:16 am

Ian i got it working the right way now.
I change my folder and files naming convention which was using "_" so it think it might have been a prob. I followed ur advice and base myself on the sef plugin and here we go its 110% :D ...
Thanks again for your tips and help.

Cheers

User avatar
ianmac
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4784
Joined: Sat Sep 24, 2005 11:01 pm
Location: Toronto, Canada

Re: Plugin issue with JDispatcher::Register event

Post by ianmac » Thu Feb 11, 2010 2:25 pm

Jerome123 wrote:Ian i got it working the right way now.
I change my folder and files naming convention which was using "_" so it think it might have been a prob. I followed ur advice and base myself on the sef plugin and here we go its 110% :D ...
Thanks again for your tips and help.

Cheers
Best of luck!

Ian

csoak
Joomla! Apprentice
Joomla! Apprentice
Posts: 42
Joined: Tue Aug 07, 2007 1:35 am

Re: Plugin issue with JDispatcher::Register event

Post by csoak » Fri Mar 19, 2010 4:05 pm

I have this error message each time I edit, change, or create a new article.

JDispatcher::register: Event handler not recognized.

I have no idea why this is going on. Ideas, instructions please?

Thanks.

tyagi.akhil
Joomla! Apprentice
Joomla! Apprentice
Posts: 35
Joined: Mon Nov 19, 2007 9:47 am

Re: Plugin issue with JDispatcher::Register event

Post by tyagi.akhil » Thu Apr 29, 2010 6:09 am

Hi

Your plugin is in legacy mode. Try to change it as in this tutorial

http://docs.joomla.org/Tutorial:Creatin ... Joomla_1.5

Thanks

Kotsolis
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 204
Joined: Mon Oct 27, 2008 6:38 pm

Re: Plugin issue with JDispatcher::Register event

Post by Kotsolis » Fri Oct 21, 2011 11:17 pm

This stupid bug also happens to me in ALL articles and also disables the ability to leave comment using JoomlaComment (by Compojoom). And why it happens? Because I've just migrated! Big deal huh? Every time I migrate to a new server I have to pay my developer extra!

I'm also using Blogommunity bridging.

ps. To Joomla Developers: I use Joomla for almost 3-4 years and I think that it would be MUCH BETTER if you would work:
a)In a bridging system to integrate phpbb, vbulletin and other common forums.
b)A comment system for articles and reviews.

Much better, instead of providing shitty upgrades which we don't need. In the contrary everyone needs a forum and a comment system in his website.

And don't start telling me that I'm trolling, especially for a thing that has 10.000 results in Google and you've done nothing so far!

User avatar
haidereen
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Wed Nov 02, 2011 12:19 am
Location: Pakistan
Contact:

Re: Plugin issue with JDispatcher::Register event

Post by haidereen » Wed Nov 02, 2011 12:31 am

Hi
i had the same problem
JDispatcher::register: Event handler not recognized
and i read all the above post to make it corrected but im not so much technical to do that
i had shifted my website to another server through Akeeba backup and after install to new sever this error come !
what i do to get rid of this error i disable all my Plugins at the back-end and one by one check each plugin by enabling to find which plugin was responsible for this error, i soon found 2 plugin which were causing this and i just uninstall them
the browser also showed after that unable to uninstall however the plugin was uninstall
after that this error was vanished :)
i reinstall the plugin and all the things work just fine 8)
likewise the code suggested above if your database information and plugin information mismatch than often this handler error (JDispatcher::register: Event handler not recognized) occurred
this error JDispatcher::register: Event handler not recognized was cumming at frontend, Admin login page and at backend but i soon fixed it up
I make My Self


Locked

Return to “Joomla! 1.5 Coding”