Hi!
I've been working on a horizontal log in box, with a no-avatar link to the profile so that the users can go and put a new one.
So far, it's doing great, the only thing is the "else" part that I'm probably missing something, because I'm getting alignment problems.
If somebody could take a look at the code and see what I'm missing, or to improve I would really appreciate that.
Also, it is meant to be a phpbox without anything... everything should be provided, borders, and classes.
And the alignment problem will look like the attached picture.
Thanks for looking!
Quoteglobal $context, $settings, $options, $txt, $scripturl, $modSettings, $user_info;
// display user name
if($context['user']['is_logged'])
{
echo '
<table align="center" border="0" cellpadding="6" cellspacing="1" class="tborder" width="100%">
<tr>
<td class="titlebg" colspan="2">
<span class="smallfont">» <a href="' . $scripturl . '?action=profile;u=;sa=account">Mi Perfil</a></span></td>
</tr>
<tr>
<td class="windowbg">';
if (!empty($context['user']['avatar']) && isset($context['TPortal']['userbox']['avatar']))
{
echo '
<div style=" width: 100%; padding: 1ex;">', $context['user']['avatar']['image'],'</div>';
}
else
{
echo '
<div style=" width: 100%; padding: 1ex;"><a href="' . $scripturl . '?action=profile;u=;sa=forumProfile"><img src="http://www.talkbass.com/forum/images/misc/noavatar.gif" border="0" alt="Editar Avatar" /></a></div>
</td>';
}
}
echo'
<td class="windowbg2" valign="top" width="100%">
<span class="smalltext" style="display:block;">';
if($context['user']['is_logged'])
{
echo '
¡Bienvenido otra vez ', $context['user']['name'] , '!
';
}
// Now, onto our second set of info, are they logged in again?
if ($context['user']['is_logged'])
{
// Is the forum in maintenance mode?
if ($context['in_maintenance'] && $context['user']['is_admin'])
echo '
', $txt[616], '
';
// Are there any members waiting for approval?
if (!empty($context['unapproved_members']))
echo '
', $context['unapproved_members'] == 1 ? $txt['approve_thereis'] : $txt['approve_thereare'], ' <a href="', $scripturl, '?action=viewmembers;sa=browse;type=approve">', $context['unapproved_members'] == 1 ? $txt['approve_member'] : $context['unapproved_members'] . ' ' . $txt['approve_members'], '</a> ', $txt['approve_members_waiting'], '
';
// Show the total time logged in?
if (!empty($context['user']['total_time_logged_in']))
{
echo '
', $txt['totalTimeLogged1'], '';
// If days is just zero, don't bother to show it.
if ($context['user']['total_time_logged_in']['days'] > 0)
echo $context['user']['total_time_logged_in']['days'] . $txt['totalTimeLogged2'];
// Same with hours - only show it if it's above zero.
if ($context['user']['total_time_logged_in']['hours'] > 0)
echo $context['user']['total_time_logged_in']['hours'] . $txt['totalTimeLogged3'];
// But, let's always show minutes - Time wasted here: 0 minutes ;).
echo $context['user']['total_time_logged_in']['minutes'], $txt['totalTimeLogged4'], '
';
echo 'Last visit: '.timeformat($user_info['last_login']).'
';
if ($context['user']['is_logged'])
echo '
<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a></td>
</tr>
<tr>
<td class="titlebg" colspan="2"><span class="smalltext"><a href="' . $scripturl . '?action=pm">Mensajes Privados</a>
</span></td>
</tr>
<tr>';
echo'
<td class="windowbg" colspan="2">';
// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
{
echo ((isset($current_action) && $curent_action == 'pm') || $context['browser']['is_ie4']) ? '' : '' , '
<span class="smalltext">', $txt[152], ' <a href="', $scripturl, '?action=pm">', $context['user']['messages'], ' ', $context['user']['messages'] != 1 ? $txt[153] : $txt[471], '</a>', $txt['newmessages4'], ' ', $context['user']['unread_messages'], ' ', $context['user']['unread_messages'] == 1 ? $txt['newmessages0'] : $txt['newmessages1'];
echo '.</span>
</td>
</tr>
</table>';
}
}
}
// Otherwise they're a guest - this time ask them to either register or login - lazy bums...
else
{
echo'
<table align="center" border="0" cellpadding="6" cellspacing="1" class="tborder" width="100%">
<tr>
<td class="titlebg" colspan="2">
<span class="smallfont">» Log in</span></td>
</tr>
<tr>
<td class="windowbg">
<form action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '" class="middletext" style="margin: -2px 1ex 0px 0;"', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '>
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/sha1.js"></script>
<table width="100%" cellspacing="3" cellpadding="0">
<tr>
<td nowrap="nowrap"><span class="smalltext">' , $txt['35'] , ': </span></td>
<td nowrap="nowrap"><input type="text" name="user" size="12" /></td>
<td nowrap="nowrap"><input type="checkbox" name="cookielength" value="43200" /><span class="smalltext">Recordar</span></td>
<td align="center" rowspan="2" width="100%">Not a member yet?
<a href="', $scripturl, '?action=register">Register Now!</a></td>
</tr>
<tr>
<td nowrap="nowrap"><span class="smalltext">' , $txt['36'] , ': </span></td>
<td nowrap="nowrap"><input type="password" name="passwrd" size="12" /></td>
<td><span class="smalltext"><input type="submit" value="', $txt[34], '" /></span></td>
<input type="hidden" name="hash_passwrd" value="" /></tr>
</table>
</form></td></tr>
</table>';
}