Advertisement:

Author Topic: How to Create an Active Link in the Description Text for a Profile Field  (Read 832 times)

Offline pepa

  • Jr. Member
  • **
  • Posts: 192
I have a standard profile field which is only displayed to the user and admin.  I want to create an active link to another area of the forum in the description text for the profile field.  Tried using standard BBC code but doesn't do anything.  Anyone know how to do this?

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 8,048
  • 'Tis the gift to be simple (duh)
Re: How to Create an Active Link in the Description Text for a Profile Field
« Reply #1 on: February 01, 2018, 04:07:04 PM »
You mean like this?

index.english.php

Code: [Select]

$txt['date_registered'] = '<a href="' . $scripturl . '?action=register">Date Registered</a>';



Offline pepa

  • Jr. Member
  • **
  • Posts: 192
Re: How to Create an Active Link in the Description Text for a Profile Field
« Reply #2 on: February 01, 2018, 07:16:53 PM »
You mean like this?

index.english.php

Code: [Select]

$txt['date_registered'] = '<a href="' . $scripturl . '?action=register">Date Registered</a>';


Sorry ... to be clearer.  When people view their forum profile they will see a Custom Profile Field to enter info into.  In the text description of that field I want to create an active URL they can click to navigate to the specific information posted in the forum.  The field and text description is:

Support the Spill
There will be a motion to Spill some board members at the AGM. Please indicate your support by entering: YES, NO, UNDECIDED. For more info read the Statement of Spill here: Community » General Category » AGM Spill » Spill Documents

I want to just display the text "For more info read the Statement of Spill" so that "Statement of Spill" is an active navigation link.  It's kind of clumsy the way I've done it currently having to enter the forum path to the info!
« Last Edit: February 01, 2018, 07:27:43 PM by pepa »

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 8,048
  • 'Tis the gift to be simple (duh)
Re: How to Create an Active Link in the Description Text for a Profile Field
« Reply #3 on: February 02, 2018, 12:41:12 PM »
Hmm, not so easily done, would require some custom coding.  Will take a look at it tonight.

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 8,048
  • 'Tis the gift to be simple (duh)
Re: How to Create an Active Link in the Description Text for a Profile Field
« Reply #4 on: February 02, 2018, 10:29:52 PM »
Profile.template.php

Code: [Select]

/// Are there any custom profile fields - if so print them!
if (!empty($context['custom_fields']))
{
if ($lastItem != 'hr')
echo '
<hr width="100%" size="1" class="hrcolor clear" />';

echo '
<dl>';

foreach ($context['custom_fields'] as $field)
{

if ($field['name'] == 'Support the Spill')
$field['desc'] = 'For more info read the <a href="https://www.google.com">Statement of Spill</a>';

echo '
<dt>
<strong>', $field['name'], ': </strong><br />
<span class="smalltext">', $field['desc'], '</span>
</dt>
<dd>
', $field['input_html'], '
</dd>';
}

echo '
</dl>';

}



Offline pepa

  • Jr. Member
  • **
  • Posts: 192
Re: How to Create an Active Link in the Description Text for a Profile Field
« Reply #5 on: February 03, 2018, 12:13:59 AM »
Yes, works a treat, thank you so much, I'm fast becoming indebted to you, you're incredibly helpful in this community .... kudos!