Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 06-15-2011, 07:12 AM
LostForWords LostForWords is offline
 
Join Date: Mar 2010
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Manually coding custom profile fields instead of using the array?

I'm trying to achieve an effect within my user CP with my custom profile fields.

I've realised I need to do this by manually writing the input code for each field as opposed to simply using the array.

I've tried a variety of codes and none seem to work, for example:

Code:
<input type="text" class="bginput" name="field3" value="" size="25" maxlength="250">
Now I find it hard to believe that it isn't possible to do this! Can anybody help me work out what exact code I'd need to write to make this work?
Reply With Quote
  #2  
Old 06-15-2011, 02:23 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have no idea what you are trying to do, so I really can't suggest anything.
Reply With Quote
  #3  
Old 06-15-2011, 09:07 PM
LostForWords LostForWords is offline
 
Join Date: Mar 2010
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, long story cut short: My board I'm using makes heavy use of custom profile fields, as in literally over 20 (other boards like mine which have been around for some time can use 100+). This may seem a bit of an alien concept, but we use the software a little differently to most people (We're an RPG board). Because they're listed all in one big list in the User CP it can be a bit hard on the eyes.

I'd like to stop the board from simply listing them all and I would instead code in the input codes for each profile field myself (for example in the modifyprofile template).

I want to do this so that A) I can split the profile fields up and divide them into categories split by a tcat row (for example) or in a new panel and B) So that I can wrap certain fields in a conditional which only allows members of a certain usergroup see them (seeing as there isn't currently a mod that enables profile fields to certain usergroups).

I hope I've explained myself a little better. Oh and all profile fields are single line text boxes.

Here is the template in userfield_textbox, perhaps you could help me modify it so I can use it how I'd like?

HTML Code:
<input type="text" class="bginput" name="userfield[$profilefieldname]" id="ctb_$profilefieldname" value="$bbuserinfo[$profilefieldname]" size="$profilefield[size]" maxlength="$profilefield[maxlength]" />

		<input type="hidden" name="userfield[{$profilefieldname}_set]" value="1" />
Reply With Quote
  #4  
Old 06-17-2011, 07:18 PM
LostForWords LostForWords is offline
 
Join Date: Mar 2010
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry to bump this, but does anybody have a clue?
Reply With Quote
  #5  
Old 06-17-2011, 08:06 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What is the problem when you use that code in the template? Are you also modifying the php code to actually change/save the data if somebody changes a field? You can't just add a variable to a form and have something (saving to the database) occur to it unless you tell it specifically to do something to it.
Reply With Quote
  #6  
Old 06-17-2011, 08:52 PM
LostForWords LostForWords is offline
 
Join Date: Mar 2010
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well I'll just quote you my modifyprofile template, and then you may be able to get a clearer picture of what I'm attempting to achieve (scroll down to where the custom profile fields normally are).

At the moment I'm just trying to see if I can get one user profile field to work before I go ahead and code the rest.


HTML Code:
<if condition="$bbuserinfo['coppauser']">
<!-- coppa text -->
<form action="register.php?do=coppaform" method="post">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
<input type="hidden" name="do" value="coppaform" />
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
	<td class="tcat">$vbphrase[coppa_information]</td>
</tr>
<tr>
	<td class="panelsurround" align="center">
	<div class="panel">
		<div style="width:$stylevar[formwidth_usercp]" align="$stylevar[left]">

			<p class="smallfont">
				<phrase 1="$vboptions[contactuslink]">$vbphrase[make_changes_parent_notified]</phrase>
			</p>

			<p class="smallfont">
				$vbphrase[print_new_permissions_form]
			</p>

			<input type="submit" class="button" style="font-weight:normal" value="$vbphrase[display_permissions_form]" />

		</div>
	</div>
	</td>
</tr>
</table>
</form>
<br />
<!-- end coppa text -->
</if>

<form action="profile.php?do=updateprofile" method="post" id="profileform">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
<input type="hidden" name="do" value="updateprofile" />

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
	<td class="tcat">$vbphrase[edit_your_details]<span class="normal"> $bbuserinfo[username]</span></td>
</tr>
<tr>
	<td class="thead">$vbphrase[registration_required_information]</td>
</tr>
<tr>
	<td class="panelsurround" align="center">
	<div class="panel">
		<div style="width:$stylevar[formwidth_usercp]" align="$stylevar[left]">

			<fieldset class="fieldset">
				<legend>$vbphrase[email_and_password]</legend>
				<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
				<tr>
					<td>$vbphrase[click_button_below_edit_email]</td>
				</tr>
				<tr>
					<td>
						<!-- don't remove -->
						<input type="image" src="$vboptions[cleargifurl]" style="width: 1px; height: 1px;" />
						<!-- / don't remove -->
						<input type="submit" class="button" style="font-weight:normal" value="$vbphrase[edit_email_and_password]" name="gotopassword" />
					</td>
				</tr>
				</table>
			</fieldset>

			<if condition="$bbuserinfo['coppauser']">
			<fieldset class="fieldset">
				<legend><label for="tb_parentemail">$vbphrase[parent_guardian_email]</label></legend>
				<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
				<tr>
					<td>$vbphrase[if_under_13_provide_parent]</td>
				</tr>
				<tr>
					<td>
						$vbphrase[parent_guardian_email]<br />
						<input type="text" class="bginput" name="parentemail" id="tb_parentemail" size="50" maxlength="30" value="$bbuserinfo[parentemail]" />
						<input type="hidden" name="coppauser" value="1" />
					</td>
				</tr>
				</table>
			</fieldset>
			</if>

			<if condition="$show['birthday_required']">
				$birthdaybit
			</if>

			$customfields[required]

		</div>
	</div>
	</td>
</tr>
</table>

<br />

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
	<td class="thead">$vbphrase[optional_information_will]</td>
</tr>
<tr>
	<td class="panelsurround" align="center">
	<div class="panel">
		<div style="width:$stylevar[formwidth_usercp]" align="$stylevar[left]">

			<if condition="$show['customtitleoption']">
			<fieldset class="fieldset">
				<legend><label for="tb_customtext">$vbphrase[custom_user_title]</label></legend>
				<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
				<tr>
					<td colspan="2">$vbphrase[title_appears_beneath_your_name]</td>
				</tr>
				<tr>
					<td>$vbphrase[your_current_user_title_is]<br /><strong>$bbuserinfo[usertitle]</strong></td>
					<td align="$stylevar[right]"><label for="cb_resettitle"><input type="checkbox" name="resettitle" value="yes" id="cb_resettitle" />$vbphrase[reset]</label></td>
				</tr>
				<tr>
					<td>$vbphrase[custom_user_title]<br /><input type="text" class="bginput" name="customtext" id="tb_customtext" value="" size="50" maxlength="$vboptions[ctMaxChars]" /></td>
				</tr>
				</table>
			</fieldset>
			</if>

			<if condition="$show['birthday_optional']">
				$birthdaybit
			</if>

			<fieldset class="fieldset">
				<legend><label for="tb_homepage">$vbphrase[home_page_url]</label></legend>
				<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
				<tr>
					<td>$vbphrase[let_other_visitors_know_url]</td>
				</tr>
				<tr>
					<td>$vbphrase[home_page_url]<br /><input type="text" class="bginput" name="homepage" id="tb_homepage" value="$bbuserinfo[homepage]" size="50" maxlength="200" dir="ltr" /></td>
				</tr>
				</table>
			</fieldset>

			<fieldset class="fieldset">
				<legend>$vbphrase[instant_messaging]</legend>
				<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
				<tr>
					<td colspan="2">$vbphrase[may_enter_identity_for_im]</td>
				</tr>
				<tr>
					<td>$vbphrase[icq_number]<br />
						<img src="$stylevar[imgdir_misc]/im_icq.gif" alt="" />
						<input type="text" class="bginput" name="icq" value="$bbuserinfo[icq]" size="25" maxlength="30" dir="ltr" /></td>
					<td>$vbphrase[aim_screen_name]<br />
						<img src="$stylevar[imgdir_misc]/im_aim.gif" alt="" />
						<input type="text" class="bginput" name="aim" value="$bbuserinfo[aim]" size="25" maxlength="30" dir="ltr" /></td>
				</tr>
				<tr>
					<td>$vbphrase[msn_messenger_handle]<br />
						<img src="$stylevar[imgdir_misc]/im_msn.gif" alt="" />
						<input type="text" class="bginput" name="msn" value="$bbuserinfo[msn]" size="25" maxlength="50" dir="ltr" /></td>
					<td>$vbphrase[yahoo_messenger_handle]<br />
						<img src="$stylevar[imgdir_misc]/im_yahoo.gif" alt="" />
						<input type="text" class="bginput" name="yahoo" value="$bbuserinfo[yahoo]" size="25" maxlength="30" dir="ltr" /></td>
				</tr>
				<tr>
					<td>$vbphrase[skype_name]<br />
						<img src="$stylevar[imgdir_misc]/im_skype.gif" alt="" />
						<input type="text" class="bginput" name="skype" value="$bbuserinfo[skype]" size="25" maxlength="32" dir="ltr" /></td>
					<td>&nbsp;</td>
				</tr>
				</table>
			</fieldset>

<if condition="$customfields['regular']">
<!-- start if customfields -->

		</div>
	</div>
	</td>
</tr>
</table>

<br />

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
	<td class="thead">$vbphrase[additional_information]</td>
</tr>
<tr>
	<td class="panelsurround" align="center">

	<div class="panel">


		<div style="width:$stylevar[formwidth_usercp]" align="$stylevar[left]">


			<fieldset class="fieldset">
				<legend><label>$vbphrase[field5_title]</label></legend>
				<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
				<tr>
					<td>$vbphrase[field5_desc]</td>
				</tr>
				<tr>
					<td><input type="text" class="bginput" name="field3" value="" size="25" maxlength="250"> <input type="hidden" name="userfield[field3_set]" value="1" /></td>
				</tr>
				</table>
			</fieldset>

		

<!-- end if custom fields -->
</if>

		</div>
	</div>

	<div style="margin-top:$stylevar[cellpadding]px">
		<input type="submit" class="button" value="$vbphrase[save_changes]" accesskey="s" />
		<input type="reset" class="button" value="$vbphrase[reset_fields]" accesskey="r" />
	</div>
	</td>
</tr>
</table>

</form>
Reply With Quote
  #7  
Old 06-17-2011, 10:19 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You aren't telling me what the problem is - how is it not working? And, as I said, you need more than just some html code. All the html does is put the field in a form, it does absolutely nothing to the actual field itself. We need to know what the exact problem is that you are having, and we also need to know your php code too - tell us what hook location you are using and then post the plugin code using the php tags, please.
Reply With Quote
  #8  
Old 06-18-2011, 02:39 AM
GavoTrav's Avatar
GavoTrav GavoTrav is offline
 
Join Date: Jun 2011
Location: Ireland
Posts: 113
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
You aren't telling me what the problem is - how is it not working? And, as I said, you need more than just some html code. All the html does is put the field in a form, it does absolutely nothing to the actual field itself. We need to know what the exact problem is that you are having, and we also need to know your php code too - tell us what hook location you are using and then post the plugin code using the php tags, please.

Lynne I'm not sure but I think he means he wants to use it without using the $post[field]

I think he wants it in HTML Or PHP

Not sure if thats it but worth a try
Reply With Quote
  #9  
Old 06-19-2011, 09:58 AM
LostForWords LostForWords is offline
 
Join Date: Mar 2010
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah I think I've confused myself and a few other people here.

I've probably gone about this all wrong, but I presumed that instead of letting the system create the list of profile field submit fields, I could write each one in manually in the modifyprofile template instead of just letting this: $customfields[regular] do its job.

I presume it's not actually possible to do this then? Without some sort of modification?
Reply With Quote
  #10  
Old 06-19-2011, 04:09 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It would be possible to do so *if* you added it to both the template AND the code. Right now, all you are doing is adding it to the template and you have written no code to process the field which means doing anything to the field in the form is going to do nothing.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:07 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04792 seconds
  • Memory Usage 2,308KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (2)bbcode_html
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete