1. ialearn
  2. Features Request
  3. Friday, April 20 2018, 09:52 AM
HI

I would like to add a text field where a person can enter a unique membership number, the field must then compare the value entered to a list of valid membership numbers, the the number is contained in the list they must be added to group "Valid Membership"

Is this possible.
admin Accepted Answer
Admin
Hi,
Easy Profile does not do this natively but it is possible by creating a simple Plugin, you can follow these steps:
- Download our skeleton plugin (you can find it at http://docs.easy-profile.com/index.php/article/triggers)
- Install it from Joomla Installer
- Enable it from Extensions->Plugins
- Open file /plugins/jsn/skeleton/skeleton.php
- Remove sample functions: "triggerFieldAvatarUpdate" and "triggerProfileUpdate"
- Add a function like this:
public function triggerProfileUpdate($user,&$data,$changed,$isNew)
{
if(isset($data['here_the_alias_of_your_field']) && !empty($data['here_the_alias_of_your_field'])){
$value = $data['HERE_THE_ALIAS_OF_YOUR_FIELD'];
/* HERE YOU CAN ADD THE CODE TO CHECK IF THE VALUE IS VALID */
if($valid) JsnHelper::addUserToGroup($user, HERE_THE_NUMERIC_ID_OF_USERGROUP_VALID_MEMBERSHIP); // if the value is valid then this add user to usergroup
else{
JsnHelper::removeUserFromGroup($user, HERE_THE_NUMERIC_ID_OF_USERGROUP_VALID_MEMBERSHIP); // if the value is not valid then this remove user from usergroup
$data['HERE_THE_ALIAS_OF_YOUR_FIELD'] = ''; // if the value is not valid then this delete the value
}
}
}


IMPORTANT NOTE: This code is not tested and not supported, this is only for example purpose.
  1. more than a month ago
  2. Features Request
  3. # 1
ialearn Accepted Answer
Hi

Thank you for all the help thus far.
One more question, the code as I have it at the moment adds the user to the required user group, would it be possible to set it up so that for example after it has added the user to group with ID 18 it checks to see if the user is also in group with ID 19 if the user is in both groups the system then adds them to Group with ID 20 as well
  1. more than a month ago
  2. Features Request
  3. # 2
ialearn Accepted Answer
Content Protected
  1. more than a month ago
  2. Features Request
  3. # 3
  • Page :
  • 1


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