Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: NIAB - lokakuu 11, 2013, 02:49:44 AP

Otsikko: Custom Profile Fields
Kirjoitti: NIAB - lokakuu 11, 2013, 02:49:44 AP
Hey Guys,

How would I go about using the custom profile fields in a script? Not too sure if they're numbered, or what.

Im trying to use them in another way for the profiles page, but all I can find in Profile.Template.php is


if (!empty($context['custom_fields']))
{
foreach ($context['custom_fields'] as $field)
if (($field['placement'] == 1 || empty($field['output_html'])) && !empty($field['value']))
echo '
<li class="custom_field">', $field['output_html'], '</li>';
}


Any pointers?
Otsikko: Re: Custom Profile Fields
Kirjoitti: Arantor - lokakuu 11, 2013, 09:15:50 AP
How about explaining the details of what you're trying to do and maybe we can help better, eh?
Otsikko: Re: Custom Profile Fields
Kirjoitti: NIAB - lokakuu 11, 2013, 04:42:46 IP
lol, yeah.

Trying to use certain parts of the custom fields in selected areas.

I currently have Add & Create soicial mediua icons to profiles mod on the forum. It gives users the option of adding Social networks to their profiles. The thing is, I am trying to setup a feed from the selected profile, but with most of them requiring Authentication to get the feed I am in need of a few more fields.. that's where the custom fields come in.

Here's an example.
For twitter, you just need $context['member']['twitter']['name/link/href'] to use it. With custom fields I have setup 4 fields for the twitter authentication which requires Access Token, Access Token Secret, Consumer Key and Consumer Secret.

I am not sure on how to call these as I can't really find a solid reference to using custom fields.
Otsikko: Re: Custom Profile Fields
Kirjoitti: Arantor - lokakuu 11, 2013, 04:45:07 IP
I can't comment on how a mod does things, only on how SMF itself does them. And SMF wouldn't load them to $context['member'] like that for custom profile fields...
Otsikko: Re: Custom Profile Fields
Kirjoitti: NIAB - lokakuu 11, 2013, 07:44:52 IP
Found a way to do it. Thanks :)