Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: cddude - heinäkuu 27, 2014, 03:34:57 IP

Otsikko: [NOT SOLVED] Getting profile fields value
Kirjoitti: cddude - heinäkuu 27, 2014, 03:34:57 IP
Hello.

Trying to make a small little mod for my site. From display.template.php I'm trying to pull the value of the first custom profile field. I have tried this, but it doesn't work:
$message['member']['custom_fields']['value'][0]
How to do this?

Better yet, instead of getting the value from first custom profile field, how to do an if statement to get the value for the profile field where its' title == xxx?

Thanks!
Otsikko: Re: Getting profile fields value
Kirjoitti: cddude - elokuu 04, 2014, 08:04:51 AP
Anyone? :)
Otsikko: Re: [NOT SOLVED] Getting profile fields value
Kirjoitti: samborabora - elokuu 04, 2014, 02:18:11 IP
I believe it was something like:

foreach ($context['custom_fields'] as $field)
if($field['colname'] == "cust_*****")
echo (empty($field['value']) ? 'they ve said nothing' : $field['value']);


Where cust_***** is the name of the field, which can be found by Chrome inspecting the input field. Check this whole thread, it may be of help? http://www.simplemachines.org/community/index.php?topic=524970.0