MyBB Community Forums

Full Version: Custom Profile Fields Default Value
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm using the plugin 'Custom Profile Fields' and I'd like a radio button to be marked to a default value after the user registers.

I tried changing my SQL database to default to 'yes' but this still leaves a blank in the data field. (this is a 'yes' 'no' radio button to a question)

Any ideas?
Why are you using a plugin for "Custom Profile Fields"? You are aware this can be donate naively via ACP -> Configuration -> Custom Profile Fields.


As for setting the default value.... change the number so it corresponds to your custom fields ID and then set it to yes (1). I am assuming 1 = yes.
		if(!$post['fid4'])
		{
			$post['fid4'] = '1';
		}
(2013-11-02, 10:34 PM)wymoree Wrote: [ -> ]Why are you using a plugin for "Custom Profile Fields"? You are aware this can be donate naively via ACP -> Configuration -> Custom Profile Fields.


As for setting the default value.... change the number so it corresponds to your custom fields ID and then set it to yes (1). I am assuming 1 = yes.
		if(!$post['fid4'])
		{
			$post['fid4'] = '1';
		}


Sorry. I was mistaken. I am using the Custom Profile Fields from the control panel.

Where do I add the code you provided?
uhhh.... woops... I got that consued with how I got the "Favorite TF 2" class to show as N/A on the postbit when one isn't defined.

I would actually like to know this myself.

I thought something like that could or would have gone in one of the function_*.php files in inc/ but I don't see a place that would fit other than the post bit.
(2013-11-02, 11:40 PM)wymoree Wrote: [ -> ]uhhh.... woops... I got that consued with how I got the "Favorite TF 2" class to show as N/A on the postbit when one isn't defined.

I would actually like to know this myself.

I thought something like that could or would have gone in one of the function_*.php files in inc/ but I don't see a place that would fit other than the post bit.

I saw another thread where this was asked for a text box default value. Their answer is below. I tried modifying it for a radio button and I can't get it to work.

 if($customfield['fid'] == X && !$userfields[$field])
            {
                $userfields[$field] = 'Not Rated';
            } 

Maybe you know how to modify their code? They stated that it should go before in member.php:

if($customfield['type'] == "textarea") 
You can use the features of this plugin: http://mybbhacks.zingaburga.com/showthre...271&page=1 to achieve that. For example Blank Replacement Value would do the thing.