The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
I added a new user field but I'm having trouble
Fixed this issue, new issue below
|
#2
|
|||
|
|||
Are you sure $vbulletin is availble at the hook?
You might need to use [minicode]$this->registry->userinfo['worksafemode'][/minicode] |
#3
|
|||
|
|||
that might be it, I figured $vbulletin was available everywhere though
Is $vbulletin just $this->registry? |
#4
|
|||
|
|||
When vB uses a class they put $vbulletin as $this->registry so they don't have to global $vbulletin for each function.
|
#5
|
|||
|
|||
can this cause an issue with cached values?
cause I'm still coding and messing with SQL queries to change the setting (since I don't have a front end to do it yet). And I just forced the field to 0, but it's still catching it and transforming to a URL (meaning it thinks $this->registry...etc is 1, not 0) |
#6
|
|||
|
|||
Not sure what you are on about cache... but $this->registry is just a reference to $vbulletin so they hold the same values.
Use var_dump() to check the values of variables if you need to. |
#7
|
|||
|
|||
Yeah I figured out the issue, nevermind. But now I have a new one..
I'm trying to add an option for this userfield (a checkbox) on the edit->options page. However I'm running into some strange issues. I'm not completely familiar with it, but I'm essentially copying another plugin. They have a hook on profile_complete, and then they throw in $customfields in there. I've done this, and made a checkbox which shows up, but I have two issues: 1) It's not updating the field correctly. I'm sifting through the PHP and also the templates, and I'm really confused how vB handles custom checkboxes. 2) All the other checkboxes default to unchecked when I have this hook enabled. I have NO idea why, as I'm only changing custom variables and nothing global. Any ideas? |
#8
|
|||
|
|||
You have to extend the datamanager.
userfield refers to the Custom Profile Fields created in the AdminCP, you've manually altered the database so you need to alter the datamanager. Find other modifications which do the same and see if you can learn from them. Check the articles section for information about Datamanagers there are articles there. There is also information in the vBulletin manual. To be honest it would be easier to use the Custom Profile Fields in the AdminCP, then use fieldX in your code e.t.c |
#9
|
|||
|
|||
Quote:
Also, this "data manager" you're referring to.. if I add a field to the User Profile Fields in Admin CP, is this altering the data manager like you're saying, or is that a different process? --------------- Added [DATE]1213226533[/DATE] at [TIME]1213226533[/TIME] --------------- This example code I'm looking, I just noticed it has another hook for profile_udateoptions, and it checks the variables and uses $userdata->set() to set the variables. I guess that's how it does it...? --------------- Added [DATE]1213228973[/DATE] at [TIME]1213228973[/TIME] --------------- Here is my code for profile_complete Code:
if($_REQUEST['do'] == 'editoptions') { // MODE $profilefieldname = 'worksafemode'; $mykey = 1; $myval = "Enable worksafe mode"; $custom = ""; $customfields['login'] .= "<fieldset class='fieldset'><legend>Worksafe Mode</legend>"; $customfields['login'] .= '<table cellpadding="0" cellspacing="3" border="0" width="100%"> <tr> <td> Check this box if you wish to enable worksafe mode, which enables worksafe-related features<br /> </td> </tr> <tr>'; $mychecked= $vbulletin->userinfo['worksafemode'] ? 'checked="checked"' : ''; $custom .= '<td valign="top"><label for="cb_cpf_'.$profilefieldname.'_'.$mykey.'"><input type="checkbox" name="userfield['.$profilefieldname.'][]" value="'.$mykey.'" id="cb_cpf_'.$profilefieldname.'_'.$mykey.'" '.$mychecked.' />'.$myval.'</label></td>'; $customfields['login'] .= $custom; $customfields['login'] .= "</tr></table></fieldset>"; } Code:
$wsmode = intval($vbulletin->GPC['userfield']['worksafemode']); $userdata->validfields['worksafemode'] = array(TYPE_NOCLEAN, REQ_NO); $userdata->set('worksafemode' $wsmode, false); |
#10
|
||||
|
||||
You can choose where to put them. Fields will not show in the Admin CP if they were not added via the Admin CP method.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|