Posted on: 01/06/04 09:41am
By: amckay
Hey folks,
I have a file with a list of people to be added to a Geeklog site. I have no problem writing a program to parse out the info I need from the file, but what I cannot find is how to encrypt the password.
I want to do my own inserts into the USERS table. Near as I can see the UID is the most important field and it is automatically generated so I do not have to worry about it. In my source file is the desired password for each user but I was poking through the GL code and cannot find how to take that and encrypt it for storage in the DB.
Are there any other things I should be careful about when writing my own code for inserting users?
Re:Help with mass user-add
Posted on: 01/06/04 09:54am
By: amckay
Aha, I think I found it - very simple in fact :
$passwd = md5($A["passwd"]);
Re:Help with mass user-add
Posted on: 01/06/04 09:57am
By: Dirk
Have you considered using the "Batch Add" option, available from the Admin's user list?
If you want to do it yourself, the code that creates a random password is in function emailpassword() in users.php
Also, you need to be careful to create all the necessary userXXX tables and add all new users to (at least) the Logged-In Users and All Users groups. Code to lift this from is in function createuser(), also in users.php
bye, Dirk
Re:Help with mass user-add
Posted on: 01/06/04 10:15am
By: amckay
Thansk Dirk. Yeah, I saw batch-add but I have 2 problems.
(1) I need to give them a non-random password, mainly because
(2) I do not have an email address for everyone
I'll take a look at the code you've indicated - should be easy to figure out I hope.
cheers,
-Alan
Re:Help with mass user-add
Posted on: 01/06/04 11:17am
By: amckay
OK, it looks like I can just copy createuser($username,$email) and add a 3rd parameter for the password I want.
A few changes later and I'm good to go.
There are only a few users in the list with no email addy so I'll log those and deal with them later.
Oh, yeah, one more thing - I have to add them all to a special group. Looks like in this function users get added to 2 groups, is that right. So all I have to do is create a 3rd one :
$normal_grp = DB_getItem($_TABLES['groups'],'grp_id',"grp_name='Logged-in Users'");
$all_grp = DB_getItem($_TABLES['groups'],'grp_id',"grp_name='All Users'");
DB_query("INSERT INTO {$_TABLES["group_assignments"]} (ug_main_grp_id,ug_uid) values ($normal_grp, $uid)");
DB_query("INSERT INTO {$_TABLES["group_assignments"]} (ug_main_grp_id,ug_uid) values ($all_grp, $uid)");
So I just make 2 more lines as above, right?
Re:Help with mass user-add
Posted on: 01/06/04 11:21am
By: Dirk
Yep
bye, Dirk
Re:Help with mass user-add
Posted on: 01/06/04 11:51am
By: amckay
BTW, what's the "User Submission Queue".
There seems to be lots to do about it in this function. Seems to be a lot of if/else statements that I can just cut away in my version of it.
Re:Help with mass user-add
Posted on: 01/06/04 01:45pm
By: amckay
OK, one final thing. Is there a function for deleting an account?
I have to test my code and want to be able to delete all the stuff when I'm done testing.
Re:Help with mass user-add
Posted on: 01/06/04 02:45pm
By: Turias
[QUOTE BY= amckay] BTW, what's the "User Submission Queue".
There seems to be lots to do about it in this function. Seems to be a lot of if/else statements that I can just cut away in my version of it.[/QUOTE]
The User Submission Queue is similiar to the Story Submission Queue, Link Submission Queue, etc. It basically requires an admin to approve each account before it is fully activated.
Re:Help with mass user-add
Posted on: 01/06/04 02:46pm
By: Dirk
[QUOTE BY= amckay] BTW, what's the "User Submission Queue".[/QUOTE]
It's similar to the story submission queue, only for users. I.e. when activated (in config.php), new users need to be approved by an Admin before they get their password emailed to them. Prior to that, they are not able to log in.
[QUOTE BY= amckay] OK, one final thing. Is there a function for deleting an account?[/QUOTE]
You could use the code from function deleteUserAccount() in usersetting.php (minus the first "if", which checks if the user id matches the currently logged-in user).
bye, Dirk
Help with mass user-add
Posted on: 07/24/04 04:23am
By: thedude
Hi Dirk.
I have stupid question for you.. Does it email to request to the admin email define in config.php? Or can it be define to forward the email to certain email address other than the one define in config.php.. ie: user admin? Please advise.
Many thanks..
The Dude
Help with mass user-add
Posted on: 07/24/04 04:36am
By: Dirk
[QUOTE BY= thedude] Does it email to request to the admin email define in config.php? Or can it be define to forward the email to certain email address other than the one define in config.php.. ie: user admin?[/QUOTE]
What exactly are you referring to? The notifications emails sent when setting $_CONF['notification']? These are always sent to the address in $_CONF['site_mail'].
bye, Dirk
Help with mass user-add
Posted on: 07/26/04 07:57pm
By: thedude
Hi Dirk.
Sorry for not being specific. I was referring to newuser account request. When someone apply for account access to your website, can the email somehow be directed to send the email to address other than $_CONF['site_mail']? Or do I need to manually hack it and create a different $_CONF['site_mail']. like $_CONF['newuser_mail']? Please advise. Thanks.
The Dude
Help with mass user-add
Posted on: 07/27/04 03:47pm
By: Dirk
As I said above, notifications are always sent to $_CONF['site_mail']. If you don't want that, you'll have to hack it ...
bye, Dirk