1. chris-reddall
  2. General
  3. Thursday, June 13 2019, 03:20 PM
  4.  Subscribe via email
Hi there,

We are trying to customise email body text that gets sent when user registers. We have tried a language override (simplest option) but would like to search and replace specific {string} string with value.

According to Joomla documentation, we can override the core class using system plugin.

This is what we have done so far

1. We copied everything from /components/com_users/models/registration.php to /templates/my-template/html/code/com_users/models/registrationoverride.php


//registrationoverride.php

//php

jimport( 'joomla.application.component.model' );

require_once(JPATH_BASE . '/components/com_users/models/registration.php');

class UsersModelRegistrationoverride extends UsersModelRegistration
{

public function register($temp)
{
//where I will customise text and send the email
}
}


2. We created system plugin - changemessage (changemessage.php, changemessage.xml) with two methods


//php

class plgSystemChangemessage extends JPlugin {

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

public function onAfterRoute(){

$app = JFactory::getApplication();

if(JRequest::getCMD('option') == 'com_users'
&& $app->isSite() == 1
&& JRequest::getCMD('task') == 'registration.register'){
//import the new class
require_once('/var/www/vhosts/http://domain.com/templates/my-template/html/code/com_users/models/registrationoverride.php');
//
}
}
}


Problem
--------------
a. New Registrationoverride class is not being used
b. System still used the core class and not the new one

Can you help us or put us in right direction to achieve this?

Thanks in advance
DHarmesh
admin Accepted Answer
Admin
Hi,
I'm sorry but these things are not related with Easy Profile, and the model override is not a native feature of Joomla.

According to Joomla documentation, we can override the core class using system plugin.
Your code seems based to a old documentation based on a 3rd party plugin that is no more available.
  1. more than a month ago
  2. General
  3. # 1
chris-reddall Accepted Answer
Pro
Hi thanks,

We have managed to do that. It would be nice if you could add this feature in future release where registration email can be customised.

Thanks for the response.

Dharmesh
  1. more than a month ago
  2. General
  3. # 2
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.