I'm writing a few plugins to handle user information through an API. There aren't any default processes I've found that could handle this entirely, so I'm using onAfterRoute to override the component model classes.
This is just checking that the component = com_users, and the view = reset or remind:
class plgSystemUseroverride extends JPlugin {
public function __construct(&$subject, $config = array()) {
parent::__construct($subject, $config);
}
public function onAfterRoute() {
$app = JFactory::getApplication();
$input = $app->input;
if('com_users' == $input->get('option') && 'reset' == $input->get('view') && !$app->isAdmin()) {
require_once(dirname(__FILE__) . '/user/reset.php');
}
if('com_users' == $input->get('option') && 'remind' == $input->get('view') && !$app->isAdmin()) {
require_once(dirname(__FILE__) . '/user/remind.php');
}
}
}
The files are copied from the users component, and I modified 'remind' for my testing: method processRemindRequest:
$return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $user->email, $subject . " TEST Subject", $body);
The modification works fine if edit the component files directly, but as a plugin the classes are not being overridden.