Assign Record to Users automatically
Posted: 2017-10-09 16:25
Hi there gyus, is there a way to assign new records to users automatically when the admin inputs them?
A place where AppGini users can exchange ideas and help each other.
https://forums.appgini.com:443/phpbb/
https://forums.appgini.com:443/phpbb/viewtopic.php?f=7&t=2524
Code: Select all
$today = time();
/* make the user is the owner of his customer record to */
sql("insert into membership_userrecords set tableName='customers',
pkValue='{$data['selectedID']}',
memberID='{$UserName}',
dateAdded='{$today}',
dateUpdated='{$today}',
groupID='{$ID_of_user's_group}'", $eo);
return FALSE;
Code: Select all
set_record_owner("customers", $data["selectedID"], $UserName);
return FALSE;
Code: Select all
function assignments_after_insert($data, $memberInfo, &$args) {
set_record_owner('assignments', $data['selectedID'], $memberInfo['username']);
return FALSE;
}
What exactly does not work? Insert? ownership?Still does not work
Datatype of what?Would the data type matter?
Code: Select all
$username_id = $data['UserName'];
Code: Select all
$memberID = sqlValue("SELECT `my_memberId_column_name` FROM `my_additional_table` WHERE `my_pk_column_name`='{$username_id}' LIMIT 1");
Code: Select all
$username_id = $data['User'];
$emailname_id = $data['Email'];
$memberID = sqlValue("SELECT `User` FROM `Member_Information` WHERE `Id`='{$username_id}' LIMIT 1");
$emailname_id = sqlValue("SELECT `Email` FROM `Member_Information` WHERE `Id`='{$emailname_id}' LIMIT 1");
sendmail(array(
'to' => $emailname_id,
'name' => '',
'subject' => 'PHFR Overtime Report',
'message' => $mail_body
));
set_record_owner('Overtime_Submission', $data['Id'], $memberID);
return FALSE;
}