Auto Registration ?
Imran Offline
Member
***
Posts: 204
Joined: Apr 2010
Post: #5
RE: Auto Registration ?
I want to get username from a list of usernames in an array and pick them randomly. Then it process creating the user and insert it into the database. Moreover, there should be an option as to how many users should be created by picking the names of that array list.

Okay, one thing I found in admin/modules/user/users.php file

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
if($mybb->input['action'] == "add")
{
	$plugins->run_hooks("admin_user_users_add");
	
	if($mybb->request_method == "post")
	{
		// Determine the usergroup stuff
		if(is_array($mybb->input['additionalgroups']))
		{
			foreach($mybb->input['additionalgroups'] as $key => $gid)
			{
				if($gid == $mybb->input['usergroup'])
				{
					unset($mybb->input['additionalgroups'][$key]);
				}
			}
			$additionalgroups = implode(",", $mybb->input['additionalgroups']);
		}
		else
		{
			$additionalgroups = '';
		}

		// Set up user handler.
		require_once MYBB_ROOT."inc/datahandlers/user.php";
		$userhandler = new UserDataHandler('insert');

		// Set the data for the new user.
		$new_user = array(
			"uid" => $mybb->input['uid'],
			"username" => $mybb->input['username'],
			"password" => $mybb->input['password'],
			"password2" => $mybb->input['confirm_password'],
			"email" => $mybb->input['email'],
			"email2" => $mybb->input['email'],
			"usergroup" => $mybb->input['usergroup'],
			"additionalgroups" => $additionalgroups,
			"displaygroup" => $mybb->input['displaygroup'],
			"profile_fields" => $mybb->input['profile_fields'],
			"profile_fields_editable" => true,
		);

		// Set the data of the user in the datahandler.
		$userhandler->set_data($new_user);
		$errors = '';

		// Validate the user and get any errors that might have occurred.
		if(!$userhandler->validate_user())
		{
			$errors = $userhandler->get_friendly_errors();
		}
		else
		{
			$user_info = $userhandler->insert_user();
			
			$plugins->run_hooks("admin_user_users_add_commit");
			
			// Log admin action
			log_admin_action($user_info['uid'], $user_info['username']);

			flash_message($lang->success_user_created, 'success');
			admin_redirect("index.php?module=user-users&action=edit&uid={$user_info['uid']}");
		}
	}
}


This is hard for me to understand. Frown Help Yumi !


[Image: logo.png]

[Image: twitter.png]
08-17-2010 10:12 AM
Visit this user's website Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
Auto Registration ? - Imran - 08-16-2010, 06:30 AM
RE: Auto Registration ? - ZiNgA BuRgA - 08-16-2010, 08:12 AM
RE: Auto Registration ? - Imran - 08-17-2010, 01:24 AM
RE: Auto Registration ? - ZiNgA BuRgA - 08-17-2010, 07:11 AM
RE: Auto Registration ? - Imran - 08-17-2010 10:12 AM
RE: Auto Registration ? - ZiNgA BuRgA - 08-17-2010, 01:45 PM
RE: Auto Registration ? - Imran - 08-17-2010, 05:25 PM
RE: Auto Registration ? - ZiNgA BuRgA - 08-17-2010, 07:00 PM

 Standard Tools
Forum Jump: