• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Sharing Custom User Field Settings

Mutt

Well-known member
#1
I'm playing around w/ the custom user fields today specifically the Contacts. I wanted to make the fields like facebook & twitter click-able links. It was very easy to do for theses.

For facebook I just clicked on the "General Options" tab and for "Value Display HTML" I entered
Code:
<a href="https://www.facebook.com/{$valueUrl}" target="_blank">{$value}</a>
For Twitter it was just as easy. I clicked on the "General Options" tab and for "Value Display HTML" I entered
Code:
<a href="https://twitter.com/{$valueUrl}" target="_blank">@{$value}</a>
what made them so easy is that xenforo already handled the difficult part of verifying the fields were valid facebook & twitter formats.

Youtube was just as simple to link but I don't have any check that the username they entered is valid. I can't even start to think up the regex since I don't know the restrictions on youtube names so it will be very easy for users to break this link.
Code:
<a href="http://www.youtube.com/user/{$valueUrl}" target="_blank">{$value}</a>
when I went to setup Google+, it was even worse since they use an ID# and I feel like I'd have to tell people how to find it & again I don't know the restrictions. is it always a 21 digit number? I'm just not sure.

So i thought I stop in here & ask if anyone would like to share their nice settings for the contact identities.
 

Jake Bunce

XenForo moderator
Staff member
#2
I can make a regex for you, but I need to know the criteria first. What constitutes a valid account name for youtube and google+?

Here is a simple regex that restricts input to alpha numeric characters:

Code:
^[a-zA-Z0-9]+$
 

Mutt

Well-known member
#3
I can make a regex for you, but I need to know the criteria first. What constitutes a valid account name for youtube and google+?

Here is a simple regex that restricts input to alpha numeric characters:

Code:
^[a-zA-Z0-9]+$
thanks but I don't know the restrictions. that's sorta what I was looking for