The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
User profile field that can parse links
I'm trying to find a way for a custom user profile field to parse links. You could have a multiline textbox, and on each line the user would enter a URL which would be turned into a link after submission.
Anyone have any ideas? |
#2
|
||||
|
||||
Create a plugin on the member_customfields hook, and turn the urls into links. Where 6 is the profile field ID.
Code:
if ($profilefield['value'] != '' AND $profilefield[profilefieldid] == 6) { $links = explode ("\n", $profilefield['value']); $output = array(); foreach ($links as $link) { $link = trim($link); if (!empty($link)) { $output[] = '<a href="' . $link . '">' . $link . '</a>'; } } $profilefield['value'] = implode('<br />', $output); } |
#3
|
||||
|
||||
When I enable that plugin, the field I'm applying it to doesn't show up.
My field ID is 9, and this is what I have for the plugin: Code:
if ($profilefield['value'] != '' AND $profilefield[profilefieldid] == 9) { $links = explode ("\n", $profilefield['value']); $output = array(); foreach ($links as $link) { $link = trim($link); if (!empty($link)) { $ouput[] = '<a href="' . $link . '">' . $link . '</a>'; } } $profilefield['value'] = implode('<br />', $output); } |
#4
|
||||
|
||||
I had a typo in the code. There is a 't' missing from the word 'output' in the if block in the foreach loop.
|
#5
|
||||
|
||||
Excellent, it works beautifully. Thank you very much!
|
#6
|
||||
|
||||
This is awesome! Thank you.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|