MyBB Community Forums

Full Version: Add more contact fields & Make hyperlinks active in User Profiles
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
hmm, that is your complete member profile? This is the complete profile from the default template set:

<html>
<head>
<title>{$mybb->settings['bbname']} - {$lang->profile}</title>
{$headerinclude}
</head>
<body>
{$header}
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="trow1">
<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td class="trow1" width="75%">
<span class="largetext"><strong>{$formattedname}</strong></span><br />
<span class="smalltext">
({$usertitle})<br />
{$groupimage}
{$userstars}<br />
<br />
<strong>{$lang->registration_date}</strong> {$memregdate}<br />
<strong>{$lang->date_of_birth}</strong> {$membday} {$membdayage}<br />
<strong>{$lang->local_time}</strong> {$localtime}<br />
<strong>{$lang->postbit_status}</strong> {$online_status}
</span>
</td><td width="25%" align="right" valign="middle">{$avatar}</td></tr></table>
</td>
</tr>
{$awaybit}
</table>
<br />
<table width="100%" cellspacing="0" cellpadding="0" border="0" align="center">
<tr>
<td width="50%" valign="top">
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td colspan="2" class="thead"><strong>{$lang->users_forum_info}</strong></td>
</tr>
<tr>
<td class="trow1"><strong>{$lang->joined}</strong></td>
<td class="trow1">{$memregdate}</td>
</tr>
<tr>
<td class="trow2"><strong>{$lang->lastvisit}</strong></td>
<td class="trow2">{$memlastvisitdate} {$memlastvisittime}</td>
</tr>
<tr>
<td class="trow1"><strong>{$lang->total_posts}</strong></td>
<td class="trow1">{$memprofile['postnum']} ({$lang->ppd_percent_total})<br /><span class="smalltext">(<a href="search.php?action=finduserthreads&amp;uid={$uid}">{$lang->find_threads}</a> &mdash; <a href="search.php?action=finduser&amp;uid={$uid}">{$lang->find_posts}</a>)</span></td>
</tr>
<tr>
<td class="trow2"><strong>{$lang->timeonline}</strong></td>
<td class="trow2">{$timeonline}</td>
</tr>
{$referrals}
{$reputation}
{$warning_level}
</table>
<br />
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td colspan="2" class="thead"><strong>{$lang->users_contact_details}</strong></td>
</tr>
<tr>
<td class="trow1" width="40%"><strong>{$lang->homepage}</strong></td>
<td class="trow1">{$website}</td>
</tr>
{$sendemail}
<tr>
<td class="{$bgcolors['pm']}"><strong>{$lang->pm}</strong></td>
<td class="{$bgcolors['pm']}"><a href="private.php?action=send&amp;uid={$memprofile['uid']}">{$lang->send_pm}</a></td>
</tr>
<tr>
<td class="{$bgcolors['icq']}"><strong>{$lang->icq_number}</strong></td>
<td class="{$bgcolors['icq']}">{$memprofile['icq']}</td>
</tr>
<tr>
<td class="{$bgcolors['aim']}"><strong>{$lang->aim_screenname}</strong></td>
<td class="{$bgcolors['aim']}"><a href="javascript:;" onclick="MyBB.popupWindow('misc.php?action=imcenter&amp;imtype=aim&amp;uid={$uid}', 'imcenter', 450, 300);">{$memprofile['aim']}</a></td>
</tr>
<tr>
<td class="{$bgcolors['yahoo']}"><strong>{$lang->yahoo_id}</strong></td>
<td class="{$bgcolors['yahoo']}"><a href="javascript:;" onclick="MyBB.popupWindow('misc.php?action=imcenter&amp;imtype=yahoo&amp;uid={$uid}', 'imcenter', 450, 300);">{$memprofile['yahoo']}</a></td>
</tr>
<tr>
<td class="{$bgcolors['msn']}"><strong>{$lang->msn}</strong></td>
<td class="{$bgcolors['msn']}"><a href="javascript:;" onclick="MyBB.popupWindow('misc.php?action=imcenter&amp;imtype=msn&amp;uid={$uid}', 'imcenter', 450, 300);">{$memprofile['msn']}</a></td>
</tr>
</table>
</td>
<td><img src="{$theme['imgdir']}/pixel.gif" height="1" width="8" alt=""/></td>
<td width="50%" valign="top">
{$profilefields}
{$signature}
{$modoptions}
{$adminoptions}
{$buddy_options}
</td>
</tr>
</table>
{$footer}
</body>
</html>

As you can see the code "<td class="trow1">{$website}</td>" shows in this code block. That is the only thing you should replace with

<td class="trow1">
<if $memprofile['website'] then>
         <li><a href="<?=htmlspecialchars_uni($memprofile['website'])?>" target="_blank"  title="view my website"></a></li></if>
</td>
As you can see the code "<td class="trow1">{$website}</td>" shows in this code block. That is the only thing you should replace with

<td class="trow1">
<if $memprofile['website'] then>
         <li><a href="<?=htmlspecialchars_uni($memprofile['website'])?>" target="_blank"  title="view my website"></a></li></if>
</td>

This is my entire member_profile in the FoundationBlue Template that I'm using. I cloned the Default Template so that I could always fall back to a pristine copy of the Default if one of my experiments with graphics and formatting went horribly wrong.

I inserted the new code where you indicated with the result being a completely blank page instead of my profile. I restore the original line and the profile comes back.

I don't know what I'm doing wrong. Have I got the code in the wrong place somehow or altered it without realizing it? I'm pretty discouraged, I don't remember ever having this much trouble simply just cutting and pasting some code before.
<html>
<head>
<title>{$mybb->settings['bbname']} - {$lang->profile}</title>
{$headerinclude}
</head>
<body>
{$header}
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="trow1">
<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td class="trow1" width="75%">
<span class="largetext"><strong>{$formattedname}</strong></span><br />
<span class="smalltext">
({$usertitle})<br />
{$groupimage}
{$userstars}<br />
<br />
<strong>{$lang->registration_date}</strong> {$memregdate}<br />
<strong>{$lang->date_of_birth}</strong> {$membday} {$membdayage}<br />
<strong>{$lang->local_time}</strong> {$localtime}<br />
<strong>{$lang->postbit_status}</strong> {$online_status}
</span>
</td><td width="25%" align="right" valign="middle">{$avatar}</td></tr></table>
</td>
</tr>
{$awaybit}
</table>
<br />
<table width="100%" cellspacing="0" cellpadding="0" border="0" align="center">
<tr>
<td width="50%" valign="top">
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td colspan="2" class="thead"><strong>{$lang->users_forum_info}</strong></td>
</tr>
<tr>
<td class="trow1"><strong>{$lang->joined}</strong></td>
<td class="trow1">{$memregdate}</td>
</tr>
<tr>
<td class="trow2"><strong>{$lang->lastvisit}</strong></td>
<td class="trow2">{$memlastvisitdate} {$memlastvisittime}</td>
</tr>
<tr>
<td class="trow1"><strong>{$lang->total_posts}</strong></td>
<td class="trow1">{$memprofile['postnum']} ({$lang->ppd_percent_total})<br /><span class="smalltext">(<a href="search.php?action=finduserthreads&amp;uid={$uid}">{$lang->find_threads}</a> &mdash; <a href="search.php?action=finduser&amp;uid={$uid}">{$lang->find_posts}</a>)</span></td>
</tr>
{$tyl_memprofile}
<tr>
<td class="trow2"><strong>{$lang->timeonline}</strong></td>
<td class="trow2">{$timeonline}</td>
</tr>
{$referrals}
{$reputation}
{$warning_level}
</table>
<br />
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td colspan="2" class="thead"><strong>{$lang->users_contact_details}</strong></td>
</tr>
<tr>
<td class="trow1" width="40%"><strong>{$lang->homepage}</strong></td>
<td class="trow1">
<if $memprofile['website'] then>
         <li><a href="<?=htmlspecialchars_uni($memprofile['website'])?>" target="_blank"  title="view my website"></a></li></if>
</td>
</tr>
{$sendemail}
<tr>
<td class="{$bgcolors['pm']}"><strong>{$lang->pm}</strong></td>
<td class="{$bgcolors['pm']}"><a href="private.php?action=send&amp;uid={$memprofile['uid']}">{$lang->send_pm}</a></td>
</tr>
<tr>
<td class="{$bgcolors['icq']}"><strong>{$lang->icq_number}</strong></td>
<td class="{$bgcolors['icq']}">{$memprofile['icq']}</td>
</tr>
<tr>
<td class="{$bgcolors['aim']}"><strong>{$lang->aim_screenname}</strong></td>
<td class="{$bgcolors['aim']}"><a href="javascript:;" onclick="MyBB.popupWindow('misc.php?action=imcenter&amp;imtype=aim&amp;uid={$uid}', 'imcenter', 450, 300);">{$memprofile['aim']}</a></td>
</tr>
<tr>
<td class="{$bgcolors['yahoo']}"><strong>{$lang->yahoo_id}</strong></td>
<td class="{$bgcolors['yahoo']}"><a href="javascript:;" onclick="MyBB.popupWindow('misc.php?action=imcenter&amp;imtype=yahoo&amp;uid={$uid}', 'imcenter', 450, 300);">{$memprofile['yahoo']}</a></td>
</tr>
<tr>
<td class="{$bgcolors['msn']}"><strong>{$lang->msn}</strong></td>
<td class="{$bgcolors['msn']}"><a href="javascript:;" onclick="MyBB.popupWindow('misc.php?action=imcenter&amp;imtype=msn&amp;uid={$uid}', 'imcenter', 450, 300);">{$memprofile['msn']}</a></td>
</tr>
</table>
</td>
<td><img src="{$theme['imgdir']}/pixel.gif" height="1" width="8" alt=""/></td>
<td width="50%" valign="top">
{$profilefields}{$socialsites}
{$signature}
{$modoptions}
{$adminoptions}
{$buddy_options}
</td>
</tr>
</table>
{$footer}
</body>
</html>

Auriel
Did you install the plugins? The template conditional plugin is needed for this to work.
(2014-04-11, 02:42 PM)Leefish Wrote: [ -> ]Did you install the plugins? The template conditional plugin is needed for this to work.

That was it. Tired brain is a stupid brain. I downloaded and expanded it. Thought I had uploaded it to the server but didn't. The profile page resolves now but the URLs in the custom boxes still don't launch when you click on them. I checked Yes for "Allow HTML for this field (will be applied for textbox and textarea only)?"

Fran Blanche
Contour Corsets
http://www.contourcorsets.com

I also tried . . .
<p><strong>Contour Corsets</strong><br />
Fran Blanche - Owner, Designer, Fabricator<br />
<a href="http://www.contourcorsets.com" target="_blank">http://www.contourcorsets.com</a></p>

Even though I turned on HTML and MyCode neither seems to work.

Is there something else dumb I'm doing?

Auriel
The code I gave you is for the website url only. I would not allow HTML in a field that a user is filling in. What is it you are trying to do? The MSN etc fields?

The code I gave you will only work for the website field - is that one working?
(2014-04-11, 09:33 PM)Leefish Wrote: [ -> ]The code I gave you is for the website url only. I would not allow HTML in a field that a user is filling in. What is it you are trying to do? The MSN etc fields?

The code I gave you will only work for the website field - is that one working?

The Homepage or Website field was already working in the first place.

Custom Profile Fields gives you the option of creating a custom textarea
As I showed in the screen capture I have the person's Corsetmaker name and the URL to their website. I need the URL to be a live link. Your plugins suggested that they would allow that to work because in the textarea it has the words . . .
Allow HTML
Allow HTML for this field (will be applied for textbox and textarea only)?
Yes No

That led me to believe that all I had to do was say yes and html placed in the textarea would work now. It doesn't so I'm really don't understand what this entire exercise was about because that is what I've been trying to do all this time. Just get the links to work in a textarea.
I see. So you have a custom field - a text area in effect - and what you enter in the field is partly text and partly a link. So the custom profile fields is the thing you want.

You need to allow the use of MyCode and any url entered in that field needs to be wrapped in an[url] tag like you do in posts.

http://www.leefish.nl

[url]www.leefish.nl[/url]
(2014-04-11, 09:45 PM)Leefish Wrote: [ -> ]I see. So you have a custom field - a text area in effect - and what you enter in the field is partly text and partly a link. So the custom profile fields is the thing you want.

You need to allow the use of MyCode and any url entered in that field needs to be wrapped in an[url] tag like you do in posts.
http://www.leefish.nl
[url]www.leefish.nl[/url]

I have HTML turned on in my forums specifically so people don't have to bother with that. On my board http://kitsu.org/ parses into a link without me having to use [url][/url]. Most of the people coming to my site are not HTML or BBS literate and wouldn't know to use [url][/url]. Just like I'm still a Newbie at managing a board. I have no idea how to create MyCode [url][/url] for the textarea even if I could make new people understand how to do it. Also, why can't I get both BB and HTML code to work in the textarea for people that do know code.

I have no idea what this means.
Regular Expression *
Enter a regular expression that will search for a specific combination of characters. You must make sure the regular expression is valid and safeā€”no validation is performed.
Example: \[b\](.*?)\[/b\]

Is there a way to format this so that as soon as it sees http:// it knows to automagically parse it as a [url][/url]?
Would this be correct? \[url\](http://*.???)\[/url\]
For questions related to the custom profile fields please ask at MyBBHacks.
(2014-04-11, 11:06 PM)Leefish Wrote: [ -> ]For questions related to the custom profile fields please ask at MyBBHacks.

Thank you for you time and patience. I've really appreciated it.

Auriel
Pages: 1 2 3