1. viryagroup
  2. Presales Question
  3. Friday, March 27 2015, 12:33 PM
Hi guys,
After the success of this on a project we were considering using this component again for another one. In this project things are going to be a bit more complicated - we have a variety of user groups for a site e.g.

Sponsor USA
Sponsor UK
Sponsor Australia

This needs to be calculated based on the value of two fields - one being their chosen group type (e.g. Sponsor, Staff) and the second being their country they are based in.

As I understand conditions in easy profile are only available for one field - rather than a combination of values - is this correct? Would we be able to work around this with a custom Joomla plugin triggering onAfterSave - or is this something where we'd be better to find another more suitable component?

Kind Regards,
George
admin Accepted Answer
Admin
Hi,
you can develop a simple plugin based on our skeleton plugin to do this (you can download at the end of doc page). docs at https://www.easy-profile.com/docs/44-triggers.html

- Download, install, and enable it
- Go into /plugins/jsn/skeleton/skeleton.php
- delete example functions: triggerFieldAvatarUpdate, triggerProfileUpdate
- add function like this:
triggerProfileUpdate($user,&$data,$changed,$isNew){ 
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
if($data['field_to_check']==some_value && $data['field_to_check2']==some_other_value)
{
$usergroup_id=10; // replace with id of your group
JsnHelper::addUserToGroup($user,$usergroup_id);
}
else
{
$usergroup_id=10; // replace with id of your group
JsnHelper::removeUserFromGroup($user,$usergroup_id);
}
....
}
  1. more than a month ago
  2. Presales Question
  3. # 1
  • 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.