Advertisement:

Author Topic: Not displaying empty lines in profile  (Read 17876 times)

Offline Burpee

  • SMF Friend
  • Sophist Member
  • *
  • Posts: 1,298
  • Gender: Male
    • Mafan.nl
Not displaying empty lines in profile
« 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:
Code: [Select]
// 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  :-[

Offline Burpee

  • SMF Friend
  • Sophist Member
  • *
  • Posts: 1,298
  • Gender: Male
    • Mafan.nl
Re: Not displaying empty lines in profile
« Reply #1 on: October 22, 2004, 12:18:27 PM »
Hmm... figured it out...
Code: [Select]
// 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>';
« Last Edit: October 22, 2004, 06:25:18 PM by Burpee »

Offline Waste

  • Jr. Member
  • **
  • Posts: 179
  • Gender: Male
  • Eh?
    • http://www.theunderside.org/
Re: Not displaying empty lines in profile
« Reply #2 on: October 22, 2004, 03:04:15 PM »
It won't let me copy/paste. :(
Guess I will have to do it by hand. :)

Offline Burpee

  • SMF Friend
  • Sophist Member
  • *
  • Posts: 1,298
  • Gender: Male
    • Mafan.nl
Re: Not displaying empty lines in profile
« Reply #3 on: October 22, 2004, 06:26:40 PM »
Hmm... odd...
Perhaps this should be moved to tips and tricks?

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 55,120
  • Gender: Male
    • Kindred-999 on GitHub
Re: Not displaying empty lines in profile
« Reply #4 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)

Code: [Select]
// 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>';
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.