I want to run 2 checks before an admin add's a new entry into a plugin database table.
The first check is to make sure the user via user_id doesn't already exsist on the plugin table.
If I can get the first one done, then doing the second check would be easy as well.
So In admin_config.php
Where it has public function beforeCreate($new_data,$old_data)
I have $user_id = $new_data['user_id'];
$sql = e107::getDb();
$check_user_id = $sql->count('service_records_sys', 'sr_id, user_id, clone_number', 'user_id = '.$user_id.'');
if($check_user_id > 0)
{
$errMsg = "The Error Message";
return $errMsg;
}
else
{
return $new_data;
}
however, it's not displaying an error message, but displays succestful message, with the new entry in the db.