Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: Burpee on October 20, 2004, 11:07:12 AM

Title: Not displaying empty lines in profile
Post by: Burpee on October 20, 2004, 11:07:12 AM
I've been wanting to do this for some time now...
Whenever people don't have their ICQ, AIM, MSN and YIM entered in the forum profile information, the profile still displays these lines but they remain empty. Would it be possible to just not display these lines for people that haven't filled them in?

The code I think should probably be edited is in Profile.template.php:
// Messenger type information.
echo '
<tr>
<td colspan="2"><hr size="1" width="100%" class="hrcolor" /></td>
</tr><tr>
<td><b>', $txt[513], ':</b></td>
<td>', $context['member']['icq']['link_text'], '</td>
</tr><tr>
<td><b>', $txt[603], ': </b></td>
<td>', $context['member']['aim']['link_text'], '</td>
</tr><tr>
<td><b>', $txt['MSN'], ': </b></td>
<td>', $context['member']['msn']['link_text'], '</td>
</tr><tr>
<td><b>', $txt[604], ': </b></td>
<td>', $context['member']['yim']['link_text'], '</td>
</tr><tr>
<td><b>', $txt[69], ': </b></td>
<td>';


Shouldn't be too hard to do, but I wouldn't know how to  :-[
Title: Re: Not displaying empty lines in profile
Post by: Burpee on October 22, 2004, 12:18:27 PM
Hmm... figured it out...
// Messenger type information.
echo '
<tr>
<td colspan="2"><hr size="1" width="100%" class="hrcolor" /></td>
</tr>';

if (!empty($context['member']['icq']['link_text']))
echo '
<tr>
<td><b>', $txt[513], ':</b></td>
<td>', $context['member']['icq']['link_text'], '</td>
</tr>';
if (!empty($context['member']['aim']['link_text']))
echo '
<tr>
<td><b>', $txt[603], ': </b></td>
<td>', $context['member']['aim']['link_text'], '</td>
</tr>';
if (!empty($context['member']['msn']['link_text']))
echo '
<tr>
<td><b>', $txt['MSN'], ': </b></td>
<td>', $context['member']['msn']['link_text'], '</td>
</tr>';
if (!empty($context['member']['yim']['link_text']))
echo '
<tr>
<td><b>', $txt[604], ': </b></td>
<td>', $context['member']['yim']['link_text'], '</td>
</tr>';
               echo '
<tr>
<td><b>', $txt[69], ': </b></td>
<td>';
Title: Re: Not displaying empty lines in profile
Post by: Waste on October 22, 2004, 03:04:15 PM
It won't let me copy/paste. :(
Guess I will have to do it by hand. :)
Title: Re: Not displaying empty lines in profile
Post by: Burpee on October 22, 2004, 06:26:40 PM
Hmm... odd...
Perhaps this should be moved to tips and tricks?
Title: Re: Not displaying empty lines in profile
Post by: Kindred on November 01, 2004, 11:14:03 AM
I like this...

As a note, it can also be applied to any of the profile settings that you do not wish to display when empty.
(I also applied it to website)


// Some more information.
if (!empty($context['member']['website']['url']))
echo '
</td>
</tr><tr>
<td><b>', $txt[96], ': </b></td>
<td><a href="', $context['member']['website']['url'], '" target="_blank">', $context['member']['website']['title'], '</a></td>
</tr>';
echo '
<tr>
<td><b>', $txt[113], ' </b></td>
<td>
<i>', $context['can_send_pm'] ? '<a href="' . $context['member']['online']['href'] . '" title="' . $context['member']['online']['label'] . '">' : '', $settings['use_image_buttons'] ? '<img src="' . $context['member']['online']['image_href'] . '" alt="' . $context['member']['online']['text'] . '" border="0" align="middle" />' : $context['member']['online']['text'], $context['can_send_pm'] ? '</a>' : '', $settings['use_image_buttons'] ? '<span class="smalltext"> ' . $context['member']['online']['text'] . '</span>' : '', '</i>
</td>
</tr><tr>';