Support

  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
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. # 1
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. # 2
  • Page :
  • 1


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

Request Support

Support is currently Offline

Support Availability

Working days: Monday to Friday. The support staff is not available on weekends; in the most of cases tickets will not be answered during that time.

Reply time: Depending on the complexity of your support issue it's usually between a few minutes and 24 hours for paid members and about one week for free members. When we expect longer delays we will notify you.

Guidelines

Before you post: read the documentation and search the forums for an answer to your question.

When you post: include Site Details if you request a support (you can use the form below the reply in Site Details tab).

Auto Solved Question: If after a week the author of the post does not reply to a request by moderator, the question will be marked as resolved.

Language: only English

Search Users

Easy ProfileĀ® is not affiliated with or endorsed by Open Source Matters or the Joomla Project. Joomla is Free Software released under the GNU/GPL License.