Advertisement:

Author Topic: Moving a specific custom field in the profile view  (Read 431 times)

Offline Aaron10

  • Full Member
  • ***
  • Posts: 528
  • Gender: Male
Moving a specific custom field in the profile view
« on: November 11, 2019, 03:03:48 PM »
Hi, I have made a custom field called "Biography" in which users can make a small paragraph, in profile.template.php I have this above the "username" field

Code: [Select]
<span style="font-weight: bold;">Biography:</span><br>
', $context['member']['options']['cust_biogra'], '<br>';

It works as expected however if the user hasn't set anything I of course get an undefined error in the log regarding the ['cust_biogra']. So if there's nothing set I need to simple just have a line break.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 72,352
Re: Moving a specific custom field in the profile view
« Reply #1 on: November 11, 2019, 03:10:05 PM »
How exactly did you make it? Seems like you didn’t use the built in feature that would hide it if there wasn’t a value set...

Online Diego Andrés

  • Customizer
  • SMF Hero
  • *
  • Posts: 3,534
  • Gender: Male
    • DiegoAndresCortes on GitHub
    • @bihgetter on Twitter
    • SMF Tricks - Free & Premium Themes
Re: Moving a specific custom field in the profile view
« Reply #2 on: November 11, 2019, 03:33:51 PM »
I think he’s trying to display it some place more specific than what the custom fields offers.

Op:
You’d need to use: if(!empty($context['member']['options']['cust_biogra'])) to solve your issue I believe

SMF Tricks - Free & Premium Responsive Themes for SMF.

Offline Aaron10

  • Full Member
  • ***
  • Posts: 528
  • Gender: Male
Re: Moving a specific custom field in the profile view
« Reply #3 on: November 11, 2019, 03:56:42 PM »
Yes that's correct, and that works great now thank you. One other small thing, I don't think you can change this in the Custom Fields area, so is it possible to modify the specific field input size for "Biography" to the same size as the Signature's input box? Like so:



If not this isn't a big deal.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 72,352
Re: Moving a specific custom field in the profile view
« Reply #4 on: November 11, 2019, 04:21:57 PM »
If you select it as large text, you can even set the size of the text box...

Offline Aaron10

  • Full Member
  • ***
  • Posts: 528
  • Gender: Male
Re: Moving a specific custom field in the profile view
« Reply #5 on: November 11, 2019, 04:26:51 PM »
Oh that's what that is, okay lol