Support

  1. FranioBed
  2. General
  3. Monday, October 22 2018, 12:16 PM
  4.  Subscribe via email
Hello,

I would like to display the easy profile custom fields in the administrator activation email. I've tried adding the custom fields in \components\com_users\models\registration.php file and overriding the COM_USERS_EMAIL_ACTIVATE_WITH_ADMIN_ACTIVATION_BODY language value to incorporate them, but this doesn't work, the custom value is a missing string. I think that core Joomla! doesn't recognise easy profile custom values, or sees them under another name than the alias listed in easy profile comoponent.
Is this even the correct way to do this? Is there another solution? Should I maybe use an another plugin? I've looked into AcyMailing, but I'm not sure it would work with easy profile and i don't want to buy it unless i'm certain.
Accepted Answer
admin Accepted Answer
Admin
ok then please try with this:
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php'); /* Load Library */
$emailBody = JText::sprintf(
'COM_USERS_EMAIL_ACTIVATE_WITH_ADMIN_ACTIVATION_BODY',
$data['sitename'],
$data['name'],
$data['email'],
$data['username'],
JsnHelper::getUser($user->id)->city_name, /* Load field value */
$data['activate']
);
  1. more than a month ago
  2. General
  3. # Permalink
admin Accepted Answer
Admin
Hi,
I've tried adding the custom fields in \components\com_users\models\registration.php

can you please provide me your modifications to understand how you have done this?

Suggestion:
I think that edit a Joomla core file is dangerous and with Joomla updates you will lose your modifications, the best way is to send a second email to the administrator without changing core files. To do this you can build a simple plugin, for example:
- Download (at the end of docs page at http://docs.easy-profile.com/index.php/article/triggers ), install and enable (Extensions->Plugins) skeleton plugin
- Open the edit the file at /plugins/jsn/skeleton/skeleton.php
- Replace entire code with this
<?php

defined('_JEXEC') or die;

class PlgJsnSkeleton extends JPlugin
{
public function triggerProfileUpdate($user, $data, $changed, $isNew)
{
if($isNew)
{
$body=$user->name." updated user profile. \n\n";
foreach($changed as $fieldalias){
$body.=$fieldalias .": ". $data[$fieldalias] ."\n";
}
$config = JFactory::getConfig();
$result=JFactory::getMailer()->sendMail(
$config->get( 'mailfrom' ), // Sender Mail
$config->get( 'fromname' ), // Sender Name
'admin1@email.com', // Receiver Mail
'New User', // Subject Mail
$body // Body Mail
);
}
}
}
IMPORTANT: Replace admin1@email.com with email of receiver
  1. more than a month ago
  2. General
  3. # 1
FranioBed Accepted Answer
Basic
Content Protected
  1. more than a month ago
  2. General
  3. # 2
admin Accepted Answer
Admin
Hi,
try with:
$data['sitename'],
$data['name'],
$data['email'],
$data['username'],
JsnHelper::getUser($user->id)->city_name, //added this line, city_name is custom value alias from easy profile
$data['activate']


By the way, do you know if using AcyMailing would work with easy profile custom fields?
Probably yes but I'm not sure :(
  1. more than a month ago
  2. General
  3. # 3
FranioBed Accepted Answer
Basic
Unfortunately, it doesn't work. I get an error: Class 'JsnHelper' not found
  1. more than a month ago
  2. General
  3. # 4
FranioBed Accepted Answer
Basic
Content Protected
  1. more than a month ago
  2. General
  3. # 5
admin Accepted Answer
Admin
great, you can find references about my code at http://docs.easy-profile.com/index.php/article/jsnuser-object
  1. more than a month ago
  2. General
  3. # 6
Alpha Accepted Answer
Hi i have tried the solution but no emails get sent. i modified the code to that one above but nothing happends when user updates their profile either custom fields or native fields. please help
  1. more than a month ago
  2. General
  3. # 7
admin Accepted Answer
Admin
Hi @Alpha,
if you need to receive an email when user edit own profile then you can try to see this topic: https://easy-profile.com/support/email-to-admin-if-profile-fields-change.html#reply-24646
  1. more than a month ago
  2. General
  3. # 8
  • 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 Online

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.