View Single Post
  #9  
Old 06-11-2008, 09:55 PM
DISLEX DISLEX is offline
 
Join Date: Apr 2006
Location: Odessa
Posts: 107
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Opserty View Post
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
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01647 seconds
  • Memory Usage 1,778KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete