The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
|
#1
|
||||
|
||||
![]()
Hi
Can anyone give me some information regards the registration process and the structure of the register.php file? There are some parts of the code that I am unable to figure out quite what is going on as I don't have sufficient knowledge of the way vbulletin works (I find it very convoluted and hard to follow at times - though once I do figure something out just how someting works the code is always elegant) Anyway the modifications I am trying to make mean I need to understand the registration process better I have already figured out I need to look at a particular section of register.php which is this section: Code:
if ($_POST['do'] == 'addmember') Code:
// assign user to usergroup 3 if email needs verification if ($vbulletin->options['verifyemail']) { $newusergroupid = 3; } else if ($vbulletin->options['moderatenewmembers'] OR $vbulletin->GPC['coppauser']) { $newusergroupid = 4; } else { $newusergroupid = 2; } $userdata->set('usergroupid', $newusergroupid); The bit I am not sure about exactly is $userdata->set('usergroupid', $newusergroupid); the $userdata->set() is a method (function) which is part of an array of methods? Code:
// set languageid $userdata->set('languageid', $vbulletin->userinfo['languageid']); // set user title $userdata->set_usertitle('', false, $vbulletin->usergroupcache["$newusergroupid"], false, false); // set profile fields $customfields = $userdata->set_userfields($vbulletin->GPC['userfield'], true, 'register'); // register IP address $userdata->set('ipaddress', IPADDRESS); More use of this $userdata->set() - but is set() the actual function that is writing the fields to the userfields file in the database or are we just building an array here? I guess really I need to know where the code for $userdata->set() is before i could answer that myself, which is what I am asking here Also what exactly is GPC() it crops up a lot but I have never really understood it (or had the need to yet) Code:
($hook = vBulletinHook::fetch_hook('register_addmember_process')) ? eval($hook) : false; Can someone explain (or point me in the direction of understanding) what this line of code actually does - I know the eval($hook) executes the contents of the variable $hook as though it was php. But what code is this $hook variable containing here and how did it get there? And why not simply put the necessary executable php in register.php without all this hook malarky to confuse things? Code:
$userdata->pre_save(); Code:
// check for errors if (!empty($userdata->errors)) { $_REQUEST['do'] = 'register'; $errorlist = ''; foreach ($userdata->errors AS $index => $error) { $errorlist .= "<li>$error</li>"; } $username = htmlspecialchars_uni($vbulletin->GPC['username']); $email = htmlspecialchars_uni($vbulletin->GPC['email']); $emailconfirm = htmlspecialchars_uni($vbulletin->GPC['emailconfirm']); $parentemail = htmlspecialchars_uni($vbulletin->GPC['parentemail']); $selectdst = array($vbulletin->GPC['dst'] => 'selected="selected"'); $sbselected = array($vbulletin->GPC['showbirthday'] => 'selected="selected"'); $show['errors'] = true; } else { $show['errors'] = false; Code:
// save the data $vbulletin->userinfo['userid'] = $userid = $userdata->save(); Thanks for any help or guidance --------------------------------------------------------- OK this next bit describes what I am actually trying to do in case it assists anyone trying to help me. It isn't really necessary for anyone to read this part, if they just want to answer the questions above. But for a deeper understanding of my site.... On my site I have a custom user field called postcode Basically when a user registers they enter the first part of their postcode which technically is called an 'outcode' and this identifies the town or city the member lives in but not the actual address There is in my database a postcodes file which contains these five fields: outcode, city/county, town, x and y coordinates The x and y co-ords are in metres starting from the bottom left hand corner of the UK (Lands End) which is x=0.0000 y=0.0000 The way another programmer working on my site implemented the next bit is the problem. When listing members in memberlist (or in forum postbits) the site uses Ajax to look up each outcode in the postcode database, and display the city or county. On actual profiles it displays the city/county + town. If someone clicks on the city/county in memberlist or postbits, the site then looks up that city or county in the postcodes database, finds all the outcodes relating to that city or couty, and finally lists all members who live in that city regardless of their actual outcode Also I have a member search facility that uses the x and y co-ordinates to find all members living within x miles (as the crow flies) using a pythagorean formula So that's what I have implemented at the moment and it works OK. The problem is that as the memberlist gets bigger, the Ajax that looks up the city/county from the postcodes database everytime is slowing things down too much So I have now added another custom userfield called 'Location' The memebrs cant' access this field directly. I added some code to memberlist.php so I can run an 'admin' function that looks up each member, uses the outcode to find the city/county and then stores this in the Location field. This all works OK. So if for example I change the postcodes file (add or change an outcode) then I can run this function to update all my members locations I am now using this Location field to display in memberlists and postbits so I no longer need the Ajax which was slowing the site down a lot What I now need to do is add code to the registration which looks up the outcode $userinfo[field6] in the postcodes file and stores the returned city/county in $userinfo[field98] Basically I need to know in the register.php file exactly where I have access to $userinfo[field6] so I can add my code do this. And also will I have access to $userinfo[field98] which is not one of the fields the member can fill in during registration I also need to do a similar alteration when a user edits their profile (as they may change the outcode) but I haven't got as far as looking at that yet Rich |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|