The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Feb 18, 2011 11:23 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Fri Feb 18, 2011 11:11 am
Posts: 2
I'm attempting to override some core Joomla file changes with the use of Plugins (using this method: http://community.joomla.org/blogs/community/521-did-you-know-overrides-are-not-just-for-html.html), this has worked fine for every core file i've needed to override until I attempted to override the controller.php file in the com_user component, i'm getting the following error -

Fatal error: Cannot redeclare class UserController in [root]\components\com_user\controller.php on line 536

But the class should be overriden with the plugin override so shouldn't be getting redeclared unless perhaps it's being called from another file/location.

Could anyone shed any light on why I may be getting this error? My plugin overide looks like this -

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

jimport( 'joomla.plugin.plugin');

/**
* Plugin override for the user controller function
*/
class plgSystemComUserOverride extends JPlugin {

       public function __construct(&$subject, $config = array()) {
          parent::__construct($subject, $config);
      }

      public function onAfterRoute() {
          $app = JFactory::getApplication();
          require_once(JPATH_ROOT . DS . 'components' . DS . 'com_test' . DS . 'overrides' . DS . 'controller.php');
      }

 }


Top
 Profile  
 
PostPosted: Mon Feb 21, 2011 9:21 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Fri Feb 18, 2011 11:11 am
Posts: 2
Can anyone help with this at all?


Top
 Profile  
 
PostPosted: Mon May 28, 2012 7:03 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Mon Aug 10, 2009 4:53 pm
Posts: 2
I don't know if you still having this problem. Anyways, I had the same problem which was caused by k2 system plugin. It contains few declarations of:
require_once (JPATH_SITE.DS.'components'.DS.'com_users'.DS.'controller.php');
And when you require a new file which includes the same class name as the core component class name (UserController)- you will get the error mentioned above
Regards


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 



Who is online

Users browsing this forum: petereks and 22 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group