Will you be able to assist with the trigger plugin?
Yes we always help our customer.
Prepare your system
- Create a field for serial number
- Create and fill in DB with same prefix of Joomla example abcd_serials (prefix is abcd_)
DB may have two columns serial (key id), userid (default=0)
Create the plugin
- download and enable the skeleton plugin - you can find here with docs
https://www.easy-profile.com/docs/44-triggers.html
- Find this file to edit /plugins/jsn/skeleton/skeleton.php
- delete example functions triggerFieldAvatarUpdate and triggerProfileUpdate
- create function like this
triggerProfileUpdate($user,&$data,$changed,$isNew){
if(isset($data['alias_of_serial_field']) && !empty($data['alias_of_serial_field']))
$db=JFactory::getDbo();
$query="SELECT serial FROM #__serials WHERE userid=0 AND serial=".$db->quote($data['alias_of_serial_field']);
$db->setQuery($query);
if($result=$db->loadResult()){
// Assign userid to serial
$query="UPDATE #__serials SET userid=".$user->id;
$db->setQuery($query);
$db->execute();
}
else{
// Error message
$app=JFactory:getApplication();
$app->enqueueMessage('Serial no valid','error');
// remore serial filled by user
unset $data['alias_of_serial_field'];
}
}
}
NOTE: this code is not tested serves only as an idea and it will not be supported