miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Specific miniBB Support Forums / Specific /  
 

Need help customizing user_from field

 
Author wilkinsmd
Guest
#1 | Posted: 13 Dec 2006 10:06 
I'm having a problem with the user_from field which I've customized a little. All of my users will be from the US, so rather than recording their country I'd like to have user_from record their home state.

First, I've modified user_dataform.html to include a select box with all the states. I didn't want to have both an input box and a select box like the default user_dataform.html has for user_from, I just want a simple select box with the state. To do that I modified bb_func_regusr.php and bb_func_editprf.php and added a new variable which calls makeValuedDropDown, in a way similar to how it works with user_sorttopics. When someone registers they can select their home state via the select box and it records the info correctly in the user_from field in the users table.

So far so good.

The problem comes when the user wants to view or update their preferences. The preferences page does not show the state they've selected (it shows the first entry in the select box) even though the user_from field has a value... the SELECTED switch in the select box is not getting set. It seems to work fine for the other fields with select boxes(user_sorttopics, user_viewemail).

My new variable in bb_func_editprf.php and bb_func_regusr.php is defined like this:
$fromstateDown=makeValuedDropDown(array(
'AL'=>'Alabama',
'AK'=>'Alaska',
...
'WY'=>'Wyoming'),'from');

I think I've tracked the problem to the makeValuedDropDown function in bb_functions.php. It's checking $GLOBALS[selectName] which is not being set, so it sets $curVal to nothing ('') which is the problem. How can I ensure that $GLOBALS['user_from'] gets set with the value that's in the users table before calling this function?

You can see this behavior for yourself here: http://www.pawinetalk.com/talk

(I also want to capture the user's home County (for those of you not familiar with the US, that's a region within the state but larger than the City) and have created a custom field for this, and am seeing identical behavior...it captures the information inputted and populates the table, but does not display it when you go to Preferences.)

I have the feeling that it's something small/stupid but I've been trying all sorts of things the last 48 hours with no luck.

Thanks for any help!
Mark

Author Paul
Lead Developer 
#2 | Posted: 13 Dec 2006 10:43 
This article can give you some starting points:

Detailed solution on how to add new custom field to user profile.

We don't recommend to edit core scripts for handling custom fields. That way you're losing easy chances to upgrade the board in the future. Custom fields can be handled without destroying the core files.

Anything else is out of our free support. Let's hope somebody else can give you an exact advice for free.

Author wilkinsmd
Guest
#3 | Posted: 13 Dec 2006 13:04 
That's not my question. I've already read that article and as stated I've successfully added another field.

My question is how to set $GLOBALS. If this is secret info or you don't want to tell me unless I pay that's fine just say so, but if not I'd appreciate any pointers.

Thanks
Mark

Specific miniBB Support Forums / Specific /
 Need help customizing user_from field
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Try the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑