Support

  1. AdinaG
  2. General
  3. Friday, April 19 2019, 01:21 AM
So I'm kinda stuck here and can't figure out how to get the fields to display in the email that have changed...

I have been the forum for at least the past 2-3 hours going around in circles trying to understand this...

I simply want to display the following custom fields in the body of the email if they change when the user updates their profile...

websiteurl
aboutme
phone

I did as as stated here https://www.easy-profile.com/support/custom-fields-in-admin-activation-email.html#reply-23320 and the skeleton.php file looks like this

<?php
/**
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
* @package Easy Profile
* website http://www.easy-profile.com
* Technical Support : Forum - http://www.easy-profile.com/support.html
*/

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";
}

JFactory::getMailer()->sendMail(
$user->email, // Sender Mail
$user->name, // Sender Name
array( 'admin@mysite.com' ), // Receiver Mail
'Email Subject', // Subject Mail
$user->name.' updated their profile.' // Body Mail
);
}
}
}
?>


But for the life of me I do not understand WHERE or HOW I'm supposed to edit it to show the custom fields.

Every time I add something it throws an error page when I try to load the profile page.

Can someone please help me? Maybe show me an example in the code above?

Thank you!

Adina
Accepted Answer
admin Accepted Answer
Admin
Hi Adina,
- 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";
}
JFactory::getMailer()->sendMail(
$user->email, // Sender Mail
$user->name, // Sender Name
array( 'admin@email.com' ), // Receiver Mail
$user->name." updated user profile.", // Subject Mail
$body // Body Mail
);
}
}
}
  1. more than a month ago
  2. General
  3. # Permalink
AdinaG Accepted Answer
Basic
Content Protected
  1. more than a month ago
  2. General
  3. # 1
pat01 Accepted Answer
Pro
Hi

Would it possible to add multiple receiver email addresses? I did try them comma separated and semicolon seperated but none of them did work (no email at all was sent).

Thanks.
  1. more than a month ago
  2. General
  3. # 2
admin Accepted Answer
Admin
Hi,
at line 18 try to replace this code
array( 'admin@email.com' )
with
array( 'admin@email.com', 'admin2@email.com','admin3@email.com' )
  1. more than a month ago
  2. General
  3. # 3
pat01 Accepted Answer
Pro
Hi

Works perfect, thanks.
  1. more than a month ago
  2. General
  3. # 4
  • 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.