Quote:
Originally Posted by Opserty
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
|
okay so you're talking about "User Profile Field" in AdminCP? Doesn't that only affect fields in "Edit Profile" and not "Edit Options"? Because I don't see any of the fields added by previous products under that menu option.
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>";
}
profile_updateoptions
Code:
$wsmode = intval($vbulletin->GPC['userfield']['worksafemode']);
$userdata->validfields['worksafemode'] = array(TYPE_NOCLEAN, REQ_NO);
$userdata->set('worksafemode' $wsmode, false);
I just tried to copy another plugin and this is the best I could come up with, hehe