1. lugoluz
  2. Support
  3. Wednesday, May 27 2015, 11:23 PM
Hello,

I'm not a developer so I don't understand well about triggers or skeleton plugin. I've read the documentation about it and some answers.

I want to find an option to activate e-mail notifications by month, year or dialy. So I can recieve a notification with changes that users did on their profiles.

For example... In july:

24 users updated their work status from no to yes.
30 users updated their marital status
12 users updated their e-mail

Then I'll recieve a mail with a quick report by end of july that will include:

Hello Dear Administrator,

33 users made changes on their profiles, please check detailed information below:

username(id) | Full Name | Fields updated | Old info | New info
1001 | Luz Lugo | Marital status; Work status | Married; Unemployed | Divorced; Working
1002 | Juan Perez | Work status | Unemployed | Working
...


Thank you.
References
  1. https://www.easy-profile.com/support/access-privileges.html#reply-871
  2. https://www.easy-profile.com/docs/38-jsnuser-object.html
  3. https://www.easy-profile.com/docs/44-triggers.html
Accepted Answer
admin Accepted Answer
Admin
Hi,
sorry but this is too complex for our support, you need a developer to make this.

Some Tip:
- Develop plugin based on our skeleton plugin to store changes from users in an DB table
- Develop system plugin to get data from DB table, generate a mail and send message
- Maybe you need also a Cron process to trigger previous system plugin
  1. more than a month ago
  2. Support
  3. # Permalink
lugoluz Accepted Answer
Easy Profile Support wrote:

Hi,
sorry but this is too complex for our support, you need a developer to make this.

Some Tip:
- Develop plugin based on our skeleton plugin to store changes from users in an DB table
- Develop system plugin to get data from DB table, generate a mail and send message
- Maybe you need also a Cron process to trigger previous system plugin


Thank you =)
  1. more than a month ago
  2. Support
  3. # 1
lugoluz Accepted Answer
Easy Profile Support wrote:

- Develop plugin based on our skeleton plugin to store changes from users in an DB table


Hello again.

Just a question, by DB table, do you mean a custom table created by me where I'll store all changes made?

I'm trying to develop the plugin, it's quite difficult :P

Thanks
  1. more than a month ago
  2. Support
  3. # 2
admin Accepted Answer
Admin
Just a question, by DB table, do you mean a custom table created by me where I'll store all changes made?
Yes, from this table you can take the data and processing them to send notifications.

I'm trying to develop the plugin, it's quite difficult

Some tips to store data in this DB table:
- Download, install and enable our Skeleton Plugin (you can download this at the end of this page: https://www.easy-profile.com/docs/44-triggers.html )
- Open file /plugins/jsn/skeleton/skeleton.php
- Remove samples functions: triggerFieldAvatarUpdate, triggerProfileUpdate
- write function like this
triggerProfileUpdate($user,&$data,$changed,$isNew){ 
if(!isNew && count($changed))
{
$user_id=$user->id;
$user_formatName=$user->name;
$user_fieldsUpdated=implode('; ',$changed);
$user_oldValues=array();
$user_newValues=array();
foreach($changed as $fieldChanged)
{
$user_oldValues[]=$user->$fieldChanged;
$user_newValues[]=$data[$fieldChanged];
}
$user_oldValues=implode('; ',$user_oldValues);
$user_newValues=implode('; ',$user_newValues);

// Code to store data in DB table
$db=JFactory::getDbo();
$query=$db->getQuery(true);
$columns = array('user_id', 'fullname', 'fieldsUpdated', 'oldValues', 'newValues');
$values = array($user_id, $db->quote($user_formatName), $db->quote($user_fieldsUpdated), $db->quote($user_oldValues), $db->quote($user_newValues));

$query->insert($db->quoteName('#__yourTable'))->columns($db->quoteName($columns))->values(implode(',', $values));

$db->setQuery($query);
$db->execute();
}
}

NOTE: this code is provided for example purpose, not tested and not supported.
  1. more than a month ago
  2. Support
  3. # 3
lugoluz Accepted Answer
Really, you're wonderful.

Thank you very much. ♥
  1. more than a month ago
  2. Support
  3. # 4
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.
Sorry, the discussion is currently locked. You will not be able to post a reply at the moment.