|
![](http://www.flexcms.com/templates/innovation_fawn/spacer.gif) |
Due to the volume of spam happening on our forums, posting is now restricted to verified members only. If you're not verified, drop us a note with your username.
|
|
![](http://www.flexcms.com/templates/innovation_fawn/spacer.gif) Home > FlexCMS Support Forum > User Help > General Support Requests > Adding users in bulk
![](http://www.flexcms.com/images/spacer.gif)
FlexCMS Support Forum
![](http://www.flexcms.com/templates/innovation_fawn/spacer.gif)
![](http://www.flexcms.com/images/spacer.gif)
Adding users in bulk Started December 8, 2007 @ 10:25pm by Wolf
![](http://www.flexcms.com/images/spacer.gif) |
Post Message |
Wolf
![](http://www.flexcms.com/images/user_avatars/1906_avatar.jpg)
Posts: 65 |
|
|
Adding users in bulk | December 8, 2007 @ 10:25pm | Wondering if you could tell me if I'm going in the right direction (or a better way to do this...)
I'm working on a project for my neighborhood. Using phpmyadmin, I added close to 700 accounts (username, address, account level, etc).
In the process, I generated a unique password for each user and temporarily stored them in the "BarePassword" field.
Now I'm working on encrypting (flex style) and storing those passwords in the real password field.
I looked at the flex code, inc-core-profile-edit-save.php around lines 73 thru 83 where you're using the crypt() function.
I'm thinking I might be able to create a new temporary page, enable "process php code" and write code to loop through the records and encrypt the passwords like is being done in the edit-save module...
Am I on the right track or might there be an easier way to accomplish this?
Thanks in advance for your feedback!
Cheers, Wolf |
|
|
|
|
|
|
| |
DCSun Administrator
![](http://www.flexcms.com/images/user_avatars/2_avatar.png)
Posts: 625 |
|
|
| December 8, 2007 @ 11:59pm | Hey Wolf,
Yes, you're on the right track there. Lines 73 through 81 in inc-core-profile-edit-save.php should do the trick. I think the only changes you'll need to make are $FormArguments['Username'] to the username pulled for the loop, and $FormArguments['Password1'] to the bare password pulled. Then you can spit $FinalPassword back into the database in the Password field and you're good to go.
BarePassword can be cleared from the database when you've encrypted it. Its purpose there is just for the registration verification system to send the user their welcome email once the new account is verified with the email link, and then it's cleared.
David
![](http://www.flexcms.com/images/spacer.gif)
![](http://www.flexcms.com/images/spacer.gif) FlexCMS v3.2 Has Been Released! |
|
|
|
|
|
|
| |
Wolf
![](http://www.flexcms.com/images/user_avatars/1906_avatar.jpg)
Posts: 65 |
|
|
Thanks and one more clarification | December 9, 2007 @ 7:33am | Hi David,
Thanks! One more clarification for me... am I reading the code correctly in that after I encrypt my temporary bare password field then I do the same thing for the username and concatenate the two together for the new password?
Cheers, Wolf |
|
|
|
|
|
|
| |
DCSun Administrator
![](http://www.flexcms.com/images/user_avatars/2_avatar.png)
Posts: 625 |
|
|
| December 9, 2007 @ 1:25pm | Wolf,
Yes, the final encrypted password is a combination of the username and password. It consists of the first 8 characters of the encrypted username and then the complete encrypted password.
David
![](http://www.flexcms.com/images/spacer.gif)
![](http://www.flexcms.com/images/spacer.gif) FlexCMS v3.2 Has Been Released! |
|
|
|
|
|
|
| |
Wolf
![](http://www.flexcms.com/images/user_avatars/1906_avatar.jpg)
Posts: 65 |
|
|
Thanks and another question | December 10, 2007 @ 11:20pm | David,
Hope you're having a great evening.
Thanks! That did the trick, encrypting my password fields for my bulk upload.
If you don't mind, I have another question...
I noticed there's a field called "ReturnTo" in the user file.
When my users log in, I'd like them to be presented with their "edit profile" page so they can enter their email address and contact information. Is there a way I can use the "ReturnTo" field to accomplish this?
Thanks!
Cheers, Wolf |
|
|
|
|
|
|
| |
DCSun Administrator
![](http://www.flexcms.com/images/user_avatars/2_avatar.png)
Posts: 625 |
|
|
| December 10, 2007 @ 11:46pm | Wolf,
No, the ReturnTo field there is currently only used to redirect after verifying the creation of a new account through the email link.
You can have your users directed to a certain page after logging in with the "Destination After Login" field in the Modify Site Preferences section. If you want everyone to end up in the same place after logging in (yourself included), simply enter the location there (such as "pages/members.html"). If you would like it determined by who they are or what level they are, you'd do it the same way but put another page in between. On the intermediate page, enable PHP and enter this code:![](http://www.flexcms.com/images/spacer.gif)
Code
if ($UserLevel < 50) { header('Location: '.$MainURL.'/pages/destination_page_1.html'); } else { header('Location: '.$MainURL.'/pages/destination_page_2.html'); } |
|
Of course, you can modify as you see fit, but that should get you started. You can also filter it further, with the $CookieUsername variable containing the username, $UserLevel containing the user's permission level, and $LoggedIn being "y" if they're logged in.
That could be used to accomplish what I think you're going for there, which is to have them brought to the Edit Profile page only on their first login. In that case you can also have the page look in the core-Users table to see if certain information you want entered hasn't been stored yet, or, since you're quite capable of modifying things to suit your needs, you could add a field to the database to record whether they'd been presented with the Edit Profile page yet.
David
![](http://www.flexcms.com/images/spacer.gif)
![](http://www.flexcms.com/images/spacer.gif) FlexCMS v3.2 Has Been Released! |
|
|
|
Last Edit: December 10, 2007 @ 11:58pm by DCSun | |
|
|
|
| |
Wolf
![](http://www.flexcms.com/images/user_avatars/1906_avatar.jpg)
Posts: 65 |
|
|
Thanks! | December 11, 2007 @ 12:00am | Thanks David,
That's exactly what I had in mind. You and the flex team Rock!
Cheers, Wolf |
|
|
|
|
|
|
| |
Wolf
![](http://www.flexcms.com/images/user_avatars/1906_avatar.jpg)
Posts: 65 |
|
|
I know... enough with the questions already! LOL | December 11, 2007 @ 12:17am | When I created my bulk user accounts I had to leave the user email fields blank (because they haven't logged in the first time to set them).
This caused me to set the "verify email" field in the "site Preferences" to NO because when I tried logging in as one of the users I received a message saying the email address hadn't yet been verified.
Have I gotten myself into a quandry?
I really WANT the email addresses to be verified, but I won't have them until the user signs in the first time.
If I leave the "verify" field set off, then it seems like I can't be sure they're giving me a good address...
Is what I'm trying to do possible? That is, allow an unverified user to login and the first time they login be forced to enter a valid email address?
Thanks, Wolf
|
|
|
|
|
|
|
| |
DCSun Administrator
![](http://www.flexcms.com/images/user_avatars/2_avatar.png)
Posts: 625 |
|
|
| December 11, 2007 @ 12:46am | That's an interesting question.
I think you're going to have to do without verifying the email address if you're pre-creating the user account in the database and don't yet know their email address. The verification system currently only operates on registrations, not profile edits, and they've already had the account created for them.
I suppose if you wanted you could start them as verified from your bulk script, and then modify the profile-save section to de-verify them when they enter and save their email address, and send them the verification link at that point.
David
![](http://www.flexcms.com/images/spacer.gif)
![](http://www.flexcms.com/images/spacer.gif) FlexCMS v3.2 Has Been Released! |
|
|
|
|
|
|
| |
Wolf
![](http://www.flexcms.com/images/user_avatars/1906_avatar.jpg)
Posts: 65 |
|
|
| December 11, 2007 @ 1:03am | Very interesting idea... I think I'll look into that.
Thanks David!
Cheers, Wolf |
|
|
|
|
|
|
|
![](http://www.flexcms.com/images/spacer.gif)
![](http://www.flexcms.com/templates/innovation_fawn/spacer.gif)
|
|
![](http://www.flexcms.com/templates/innovation_fawn/spacer.gif) | MEMBERS ![](http://www.flexcms.com/templates/innovation_fawn/spacer.gif)
|
![](http://www.flexcms.com/templates/innovation_fawn/spacer.gif)
|
|