Hi, I need to add users, but, it cannot be done via the Admin panel, I need to add them into the membership_users via the appgini app.
Thanks in advance.
add users via appgini
Re: add users via appgini
Hi,
maybe you could create a table in AppGini with the same parameters as in membership_users. Create the app, go to the DB, remove the table and create a view for this tablename as a select * from membership_users.
Like this you could enter the data into the membership_user via the normal functionality.
WARNING: There might be more to consider as to if you want set a password to the user, or assign a group to the user.
maybe you could create a table in AppGini with the same parameters as in membership_users. Create the app, go to the DB, remove the table and create a view for this tablename as a select * from membership_users.
Like this you could enter the data into the membership_user via the normal functionality.
WARNING: There might be more to consider as to if you want set a password to the user, or assign a group to the user.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: add users via appgini
Hello
i already do that on my project
1- make table name ( Users ) or any name you want .
filed : ID , User_Name, User_Group, Name, Password, Password01, User_Mail, Date
2- user this code on Users.php in hooks folder
i already do that on my project
1- make table name ( Users ) or any name you want .
filed : ID , User_Name, User_Group, Name, Password, Password01, User_Mail, Date
2- user this code on Users.php in hooks folder
Code: Select all
function Users_after_insert($data, $memberInfo, &$args) {
$Emp_ID = $data["selectedID"];
$memberID = $data['User_Name'];
$password = $data['Password'];
$email = $data['User_Mail'];
$Name = $data['Name'];
$groupID = $data['User_Group'];
$member = sqlValue("select COUNT(*) from membership_users where memberID='{$memberID}'");
if($member == 0) {
sql("INSERT INTO `membership_users` set memberID='{$memberID}', passMD5='" . password_hash($password, PASSWORD_DEFAULT) . "', email='{$email}', signupDate='" . @date('Y-m-d') . "', groupID = '{$groupID}', isBanned= 0, isApproved= 1 , custom1='{$Emp_name}' ", $eo);
return false;
}
-
- Veteran Member
- Posts: 104
- Joined: 2018-12-10 21:52
Re: add users via appgini
You guys are LIFE SAVERS!!!!!!
Gonna try!
THANKS!!!
Gonna try!
THANKS!!!
Re: add users via appgini
Hi, how do you delete membership_users using hooks/users.php ?
xbox2007 wrote: ↑2022-03-30 07:26Hello
i already do that on my project
1- make table name ( Users ) or any name you want .
filed : ID , User_Name, User_Group, Name, Password, Password01, User_Mail, Date
2- user this code on Users.php in hooks folder
Code: Select all
function Users_after_insert($data, $memberInfo, &$args) { $Emp_ID = $data["selectedID"]; $memberID = $data['User_Name']; $password = $data['Password']; $email = $data['User_Mail']; $Name = $data['Name']; $groupID = $data['User_Group']; $member = sqlValue("select COUNT(*) from membership_users where memberID='{$memberID}'"); if($member == 0) { sql("INSERT INTO `membership_users` set memberID='{$memberID}', passMD5='" . password_hash($password, PASSWORD_DEFAULT) . "', email='{$email}', signupDate='" . @date('Y-m-d') . "', groupID = '{$groupID}', isBanned= 0, isApproved= 1 , custom1='{$Emp_name}' ", $eo); return false; }
Re: add users via appgini
hello
if you already make table name (users) and already add users with this table ,, in this case you will find all users you add on this table
so we can use query to delete user in function Users_after_delete($data, $memberInfo, &$args)
other way you can use Admin Area
if you already make table name (users) and already add users with this table ,, in this case you will find all users you add on this table
so we can use query to delete user in function Users_after_delete($data, $memberInfo, &$args)
Code: Select all
function Users_after_delete($selectedID, $memberInfo, &$args) {
$memberID = $data['User_Name'];
sql("DELETE FROM membership_users WHERE memberID='{$memberID}'", $eo);
}
Re: add users via appgini
Hi,
just a small comment. You cannot reference the $data array in the delete hooks.
just a small comment. You cannot reference the $data array in the delete hooks.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.