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
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']}");}}}