The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Automatic Account Creation Issues
I use a script in Modernbill which allows me to setup a forum account when a client signs up with me automatically.
This was working fine in 3.0.X but since upgrading to 3.5.X it has some issues with creating the user such as when listing a thread you can not click on the username to send a PM, Email or look at profile. You can get a good idea of what I am talking about by looking at this thread , note the pmnowak user is the one having the issue but my account which I created myself by signing up works fine. Another issue is when I go to PM any of these users setup by the API script through modernbill I am unable to edit the user in AdminCP or send the user a PM. I did post in the paid request forum but no one got back to me so I figured I would try here and see if anyone has any suggestions Here is the code from the script HTML Code:
##############################
## NEW VBULITTEN CODE BEGIN ##
##############################
// ###################### Start makesalt #######################
// generates a totally random string of $length chars
function fetch_user_salt($length = 3)
{
$salt = '';
for ($i = 0; $i < $length; $i++)
{
$salt .= chr(rand(32, 126));
}
return $salt;
}
// ###################### Start htmlspecialchars_uni #######################
function htmlspecialchars_uni($text)
{
// this is a version of htmlspecialchars that still allows unicode to function correctly
$text = preg_replace('/&(?!#[0-9]+;)/si', '&', $text); // translates all non-unicode entities
return str_replace(array('<', '>', '"'), array('<', '>', '"'), $text);
}
// ###################### Start build datastore #######################
function build_datastore($title = '', $data = '')
{
GLOBAL $forum_table_prefix; //Config Option
$forum_table_prefix = ($forum_table_prefix!='') ? trim($forum_table_prefix) : NULL;
$forum_dbh = forum_connect();
if ($title != '')
{
$sql ="REPLACE INTO " . $forum_table_prefix . "datastore
(title, data)
VALUES
('" . addslashes(trim($title)) . "', '" . addslashes(trim($data)) . "')";
$result = mysql_query_logger($sql,$forum_dbh);
if (!$result) {
return '['.ERROR.' '.mysql_errno().'] '.mysql_error();
}
}
}
function create_vbulletin_user($username,$password,$email)
{
GLOBAL $forum_table_prefix; //Config Option
define('TIMENOW', time());
define('thedate', date("Y-m-d"));
$forum_table_prefix = ($forum_table_prefix!='') ? trim($forum_table_prefix) : NULL;
$forum_dbh = forum_connect();
$salt = fetch_user_salt(3);
$usertitle = "Hosting Client";
$birthday = '';
$birthday_search = '';
$hashedpassword = md5(md5($password) . $salt);
$sql = "INSERT INTO ".$forum_table_prefix."user
(username, salt, password, passworddate, email, styleid, parentemail,
showvbcode, usertitle, joindate, daysprune, lastvisit, lastactivity, usergroupid, timezoneoffset,
options, maxposts, threadedmode, startofweek, ipaddress, pmpopup, referrerid,
reputationlevelid, reputation, autosubscribe, birthday, birthday_search)
VALUES
('" . addslashes(htmlspecialchars_uni($username)) . "',
'" . addslashes($salt) . "',
'" . addslashes($hashedpassword) . "',
'". date("Y-m-d") ."',
'" . addslashes(htmlspecialchars_uni($email)) . "',
'1',
'',
'1',
'" . addslashes($usertitle) . "',
'" . time() . "',
'0',
'" . time() . "',
'" . time() . "',
'2',
'0',
'7255',
'-1',
'0',
'1',
'127.0.0.1',
'1',
'',
'5',
'10',
'-1',
'$birthday',
'$birthday_search')";
$result1 = mysql_query_logger($sql,$forum_dbh);
if (!$result1) {
return '['.ERROR.' '.mysql_errno().'] '.mysql_error();
}
$temp_user_id = mysql_insert_id();
mt_srand ((double) microtime() * 1000000);
$activationid=mt_rand(0,100000000);
$sql = "INSERT INTO ".$forum_table_prefix."useractivation (useractivationid, userid, dateline, activationid, type, usergroupid ) VALUES (NULL, '$te$ $result2 = mysql_query_logger($sql,$forum_dbh);
if (!$result2) {
return '['.ERROR.' '.mysql_errno().'] '.mysql_error();
}
$sql = "INSERT INTO ".$forum_table_prefix."userfield (userid, temp, field1, field2, field3, field4 ) VALUES ('$temp_user_id','','','','','')";
$result3 = mysql_query_logger($sql,$forum_dbh);
// get total members
$sql = "SELECT COUNT(*) AS total, MAX(userid) AS max FROM ".$forum_table_prefix."user";
$result4 = mysql_query_logger($sql,$forum_dbh);
if (!$result4) {
return '['.ERROR.' '.mysql_errno().'] '.mysql_error();
}
$row = mysql_fetch_array($result4);
// get newest member
$sql = "SELECT * FROM " . $forum_table_prefix . "user WHERE userid = $row[max]";
$result5 = mysql_query_logger($sql,$forum_dbh);
if (!$result5) {
return '['.ERROR.' '.mysql_errno().'] '.mysql_error();
}
$newuser = mysql_fetch_array($result5);
// make a little array with the data
$values = array(
'numbermembers' => $row['total'],
'newusername' => $newuser['username'],
'newuserid' => $newuser['userid']
);
// update the special template
build_datastore('userstats', serialize($values));
return ($result5) ? 1 : '['.ERROR.' '.mysql_errno().'] '.mysql_error() ;
}
##############################
## NEW VBULITTEN CODE END ##
##############################
|
#2
|
|||
|
|||
I would start by not trying to duplicate vB functions, but simply include the vB function file (most would already be loaded by including global.php).
PS Moved to the correct forum. |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|