How to Create an Active Link in the Description Text for a Profile Field

Started by pepa, February 01, 2018, 02:40:45 AM

Previous topic - Next topic

pepa

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?

Sir Osis of Liver

You mean like this?

index.english.php



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



Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

pepa

Quote from: Sir Osis of Liver on February 01, 2018, 04:07:04 PM
You mean like this?

index.english.php



$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!

Sir Osis of Liver

Hmm, not so easily done, would require some custom coding.  Will take a look at it tonight.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Sir Osis of Liver

Profile.template.php



/// 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>';

}



Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

pepa

Yes, works a treat, thank you so much, I'm fast becoming indebted to you, you're incredibly helpful in this community .... kudos!

Advertisement: