Custom Project Jun 7 2012 15:01:59

IN PROGRESS
Project Budget (USD)
$30

Project Description:
Hi, the project you have worked on for me before, I just need modification to this function, instead of creating new user, i need it to choose existing user from vb database:

function newuser($data) {
global $vbulletin;

$userid = 0;

if (!isset($data['yahoo_usernick']) OR empty($data['yahoo_usernick'])) return false;

$username = $data['yahoo_usernick'];
$email_user = create_random_string(6) . create_another_random_string(8);
$email_domain = substr($vbulletin->options['webmasteremail'], strpos($vbulletin->options['webmasteremail'], "@"));
$email = $email_user . $email_domain;
if (!strpos($email, "@"))
{
$unick = explode(" ", $username);
$email = $unick[0] . '@yahoo.com';
}
$password = create_random_string(18);
$ip = random_ip();

$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_ARRAY);
$userdata->set('username', $username);
$userdata->set('email', $email);
$userdata->set('password', $password);
$userdata->set('ipaddress', $ip);
$userdata->set('signature', $vbulletin->options['icc_yahoo_attribution']);
$userdata->set('usergroupid', $vbulletin->options['icc_usergroup_id']);
$userdata->pre_save();

if (!empty($userdata->errors)) return false;
$userid = $userdata->save();

unset($userdata);

// now add an av
if ($vbulletin->options['icc_import_avatars'])
{
if (isset($data['yahoo_user_photo_url']) AND !empty($data['yahoo_user_photo_url']))
{
// begin custom avatar code
require_once(DIR . '/includes/class_upload.php');
require_once(DIR . '/includes/class_image.php');

$upload = new vB_Upload_Userpic($vbulletin);
$upload->data =& datamanager_init('Userpic_Avatar', $vbulletin, ERRTYPE_STANDARD, 'userpic');
$upload->userinfo['userid'] = $userid;
$upload->image =& vB_Image::fetch_library($vbulletin);
$upload->maxwidth = $vbulletin->userinfo['permissions']['avatarmaxwidth'];
$upload->maxheight = $vbulletin->userinfo['permissions']['avatarmaxheight'];
$upload->maxuploadsize = $vbulletin->userinfo['permissions']['avatarmaxsize'];
$upload->allowanimation = ($vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['cananimateavatar']) ? true : false;

$upload->process_upload($data['yahoo_user_photo_url']);
}
}

return array('userid' => $userid, 'ip' => $ip);
}

/**
* This function creates a new thread from the queue
* given a forumid and a timestamp
* @global
* @param integer $forumid the id of the forum to create a thread in
* @param integer $poststamp the timestamp of the new thread
*/

Skills required:
vBulletin
Additional Files: functions_nex_answers.php
Project offered by:
Verified