Attribute in Profile
Permalink
Hi All,
I have created a user attribute for a user to enter his website upon registration. How would I make the website the user has entered in the field an active link people can click on in his profile? As it is, it only displays as text in the member profile page. I'd even be happy with the URL displaying in the sidebar as long as it was a live link. Can anyone point me to a "How to" that will help?
Thanks so much!
Hope
I have created a user attribute for a user to enter his website upon registration. How would I make the website the user has entered in the field an active link people can click on in his profile? As it is, it only displays as text in the member profile page. I'd even be happy with the URL displaying in the sidebar as long as it was a live link. Can anyone point me to a "How to" that will help?
Thanks so much!
Hope
I found a way but doubt this the proper way. Surely there is a better way to accomplish this?
Thanks, mhawke! That works much better!
You should also make sure that the member hasn't already added the 'http' part when they entered their website information. Something like:
<?php $parsed = parse_url($profile->getAttribute('website', 'displaySanitized', 'display')); $website = 'http://' . $parsed['host'] . $parsed['path']; ?>
Thanks. Before I get to the parse code, I have a question. In case the user does not have a website/enters nothing in the field, I would like to display nothing or a blank space. What it currently prints is http:// on the profile is user has no website. I tried messing around with an if else statement but have mangled it. The code below does not work (of course!). Any hints on how to get it working?
Also tried this but it only prints "No website" regardless of whether the user has one or not.
Also tried this but it only prints "No website" regardless of whether the user has one or not.
Thanks. I tried it and am getting the following:
Parse error: syntax error, unexpected 'if' (T_IF) in domain.com/c5/single_pages/profile/view.php on line 21
It could be something I've messed up so I'll clean up some of the lines I've been adding.
Parse error: syntax error, unexpected 'if' (T_IF) in domain.com/c5/single_pages/profile/view.php on line 21
It could be something I've messed up so I'll clean up some of the lines I've been adding.
Okay... I added a ; on the end of one line and now it works but the URL is not an active url so to speak. It's just typing the text but maybe I can figure it out. :-)
Glad it's working.