Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-23-2011, 08:26 PM
AFemaleProdigy's Avatar
AFemaleProdigy AFemaleProdigy is offline
 
Join Date: Mar 2006
Location: Murrells Inlet, SC
Posts: 216
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Custom user.php with specific custom profile fields...

Hello,

I am creating multiple custom user.php files to make creation of specific user types easier. I have entirely too many custom profile fields that are specific to user types to keep them all in one single user.php. I need some assistance figuring out the proper code for just a few things.

Rather than use the existing lines that generate ALL of the custom profile field options, I want to display only specific custom profile field options. For example, in user.php there are lines like this:

PHP Code:
print_select_row($vbphrase['language'] , 'user[languageid]', array('0' => $vbphrase['use_forum_default']) + fetch_language_titles_array(''0), $user['languageid']); 
I need to write a line similar to that which loads a specific user profile field and it's available input/select/radio options. I am just not sure how to write it, how to call the field, and how to load the options for the field.

I was trying to guess at it and came up with this, but it doesn't work right. I need it to load the array of options specific to that field... NOT a vbphrase:

PHP Code:
print_select_row($vbphrase['field11_title'], 'user[field11]', array(=> $vbphrase['venue_type_a'], => $vbphrase['venue_type_b'], => $vbphrase['venue_type_c']), $user['field11']); 
Should I use this instead: print_chooser_row

Any suggestions? Thanks!

--------------- Added 24 Nov 2011 at 10:50 ---------------

Anyone have any ideas? I just need to know the bit of code to load a specific profile field and its selectable options in user.php.

Thanks!
Reply With Quote
  #2  
Old 11-26-2011, 06:33 PM
AFemaleProdigy's Avatar
AFemaleProdigy AFemaleProdigy is offline
 
Join Date: Mar 2006
Location: Murrells Inlet, SC
Posts: 216
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Help?
Reply With Quote
  #3  
Old 11-28-2011, 03:04 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry, but I'm not sure what you want to do. Are you asking how to use the print_select_row() function?
Reply With Quote
  #4  
Old 11-28-2011, 03:17 AM
AFemaleProdigy's Avatar
AFemaleProdigy AFemaleProdigy is offline
 
Join Date: Mar 2006
Location: Murrells Inlet, SC
Posts: 216
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry if my explanation wasn't clear. In admincp, you use user.php to create new users and enter the details for that user's custom profile fields. By default, user.php lists ALL custom profile field options that have been created in the database. I have created a secondary modified user-venue.php file, and want to display only certain custom profile fields, not all of them like the default does.

So, I need to remove the default code that generates ALL of the custom profile field options in my modified user-venue.php. I located it and removed it. Now, I need to replace that with the code that will generate specific profile fields. I don't know what code to use to make that happen.

My goal is to have a secondary user.php file that will make my life easier by only showing me the custom profile fields I want, relative to the type of usergroup I am putting someone in.

Does that make more sense? Thanks for replying, by the way.
Reply With Quote
  #5  
Old 11-28-2011, 03:39 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, I think I get that. Assuming I do understand, it seems like the easiest thing to do would be to leave the existing code but modify the SQL to get the fields you want, or else leave the SQL to get all the fields but modify the loop to "continue;" if the field is not one that you want to display.
Reply With Quote
  #6  
Old 11-28-2011, 03:50 AM
AFemaleProdigy's Avatar
AFemaleProdigy AFemaleProdigy is offline
 
Join Date: Mar 2006
Location: Murrells Inlet, SC
Posts: 216
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, I wouldn't know how to go about doing that. I still want the original user.php file to function as normal. Would what you are suggesting affect the original as well as the new modified version, user-venue.php?
Reply With Quote
  #7  
Old 11-28-2011, 04:04 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It would only affect your new file if you don't modify the code in user.php. I assume you removed this code?:

Code:
	$profilefields = $db->query_read("
		SELECT *
		FROM " . TABLE_PREFIX . "profilefield AS profilefield
		LEFT JOIN " . TABLE_PREFIX . "profilefieldcategory AS profilefieldcategory ON
			(profilefield.profilefieldcategoryid = profilefieldcategory.profilefieldcategoryid)
		ORDER BY profilefield.form, profilefieldcategory.displayorder, profilefield.displayorder
	");
	while ($profilefield = $db->fetch_array($profilefields))
	{
		if ($profilefield['form'] != $currentform)
		{
			print_description_row(construct_phrase($vbphrase['fields_from_form_x'], $forms["$profilefield[form]"]), false, 2, 'optiontitle');
			$currentform = $profilefield['form'];
		}
		print_profilefield_row('userfield', $profilefield, $userfield, false);
		construct_hidden_code('userfield[field' . $profilefield['profilefieldid'] . '_set]', 1);
	}

so if you have a list of profilefieldids you want to display in your modified file, you could probably change the query part to be something like (line in red added):

Code:
	$profilefields = $db->query_read("
		SELECT *
		FROM " . TABLE_PREFIX . "profilefield AS profilefield
		LEFT JOIN " . TABLE_PREFIX . "profilefieldcategory AS profilefieldcategory ON
			(profilefield.profilefieldcategoryid = profilefieldcategory.profilefieldcategoryid)
 		WHERE profilefieldid IN(1, 2, 3, 4)
		ORDER BY profilefield.form, profilefieldcategory.displayorder, profilefield.displayorder
	");
Reply With Quote
  #8  
Old 11-28-2011, 04:24 AM
AFemaleProdigy's Avatar
AFemaleProdigy AFemaleProdigy is offline
 
Join Date: Mar 2006
Location: Murrells Inlet, SC
Posts: 216
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I tried what you suggested and it worked! Hurray!!! Thanks so much! I was trying to do it a harder way, of course! Lol!

So for anyone trying to do this... forget everything I was trying and do what kh99 said in the last post.
Reply With Quote
Reply


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 09:55 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04130 seconds
  • Memory Usage 2,241KB
  • Queries Executed 11 (?)
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
  • (2)bbcode_code
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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_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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete