The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Importing custom fields (solved)
I have decided to write a process to allow users to log in under their old password instead of forcing everyone to run "forget password".
How i am doing that is creating 2 custom fields in user called importpassword and importsalt. The way it'll work is hook the login failure, check these secondary fields and then allow the login. If this passes it'll update the password to the vb format and then clear those fields. I have got that basically working - it currently works with a hardcoded password of '12345' to log in as anyone. The only issue i have is getting the data into the 2 fields i've created in user using the import. I tried first add_custom_field/value but that ended up adding fields to the profile fields table which is not what i want. I have modified the insert sql query to include the 2 extra fields and added this bit of code in: Code:
$try->set_value('nonmandatory', 'importpassword', $user_details['Password']); $try->set_value('nonmandatory', 'importsalt', $user_details['Salt']); Cheers Please note - i need no help with the plugin creation, only the alteration of the import system to include 2 extra fields. --------------- Added [DATE]1212490995[/DATE] at [TIME]1212490995[/TIME] --------------- Ok, finally got this working. I will outline the steps if anyone in the future is wanting to import additional fields into the 'user' table. 1. Add 2 extra fields into DB, nullable. 2. In file: ImpExData.php, function is_valid. Change: Code:
foreach (($this->_values[$this->_datatype]['nonmandatory']) AS $key => $value) { Code:
foreach (($this->_values[$this->_datatype]['nonmandatory']) AS $key => $value) { // Skip additional fields if($key == 'importpassword' || $key == 'importsalt') { continue; } 3. In file: ImpExData.php, function set_value Change: Code:
function set_value($section, $name, $value) { if (@array_key_exists($name, $this->_values[$this->_datatype][$section])) Code:
function set_value($section, $name, $value) { // Check field but skip additional fields if (@array_key_exists($name, $this->_values[$this->_datatype][$section]) || $name == 'importpassword' || $name == 'importsalt') 4. In file: ImpExData.php, function import_user (around line 2205 - be careful similar line earlier) Change: Code:
autosubscribe, profilepicrevision Code:
autosubscribe, profilepicrevision, importpassword, importsalt 5. In file: ImpExData.php, function import_user (around line 2253 - be careful similar line earlier) Change: Code:
'" . $this->get_value('nonmandatory', 'profilepicrevision') . "' ) "; Code:
'" . $this->get_value('nonmandatory', 'profilepicrevision') . "', '" . $this->get_value('nonmandatory', 'importpassword') . "', '" . $this->get_value('nonmandatory', 'importsalt') . "' ) "; 6. In file: 004.php, function resume Change: Code:
$try->set_value('nonmandatory', 'timezoneoffset', $user_details['Time_offset_hours']); $try->set_value('nonmandatory', 'pmpopup', $user_details['PM_notify']); $try->set_value('nonmandatory', 'options', $this->_default_user_permissions); Code:
$try->set_value('nonmandatory', 'timezoneoffset', $user_details['Time_offset_hours']); $try->set_value('nonmandatory', 'pmpopup', $user_details['PM_notify']); $try->set_value('nonmandatory', 'options', $this->_default_user_permissions); /// Additional Fields $try->set_value('nonmandatory', 'importpassword', $user_details['Password']); $try->set_value('nonmandatory', 'importsalt', $user_details['Salt']); And that should allow to the 2 extra fields (importpassword, importsalt), to be imported from old database into the new database's 'user' table without causing any errors. Please note: try at your own risk - no support offered. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|