TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,911
  • Total Topics: 21,307
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 359
  • Total: 360
  • tino

Horizontal User and Forum Stats block?

Started by keith021773, October 28, 2009, 01:30:07 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Zetan

Looks great. Good job Freddy :up:

oh.. er, can we move this to Snippet Requests, or Block Code Snippets?

Freddy

Yes Zetan, I was thinking that too - do you want to transfer the whole thread ?

Keith - I will take a look at this ad space for you.  Back later...


Freddy

#23
Okay try this out.  Depending on screen size you could probably get a longer advert in there too.  You will need to align it as you see fit.  I used your example image to demonstrate it in action.

Also, you could wrap the whole table in a DIV and centralise it if you wanted.


global $context, $settings, $options, $scripturl, $txt, $modSettings;

$bullet = '<img src="Themes/default/images/tinyportal/TPdivider.gif" style="margin-right: 5px; margin-left: 5px" />';

// If the user is logged in, display stuff like their name, new messages, etc.
if ($context['user']['is_logged'])
{
echo '
<table>
<tr>
<td colspan="3">
<strong>', $txt['hello_member'], ' ', $context['user']['name'], '</strong>
</td>
<td rowspan="2">';

// Advert area...
echo '
<img style="margin: 5px" src="http://www.publicworksgroup.com/blog/wp-content/themes/PassionDuo_Blue/images/ad.jpg" alt="" title="title" height="125" width="125" />';
// Advert end.

echo '
</td>
</tr>
<tr>
<td>';

// Avatar
if (!empty($context['user']['avatar']) && isset($context['TPortal']['userbox']['avatar']))
echo '<p>' , $context['user']['avatar']['image'] , '</p>';

echo '
</td>
<td>';

// Only tell them about their messages if they can read their messages!
if ($context['allow_pm'])
{
echo '
' , $bullet , '<a href="', $scripturl, '?action=pm">' .$txt['tp-pm'].' ', $context['user']['messages'], '</a><br />';

if($context['user']['unread_messages']>0)
echo '
' , $bullet , '<a href="', $scripturl, '?action=pm">' .$txt['tp-pm2'].' ',$context['user']['unread_messages'] , '</a><br />';
}

// Are there any members waiting for approval?
if (!empty($context['unapproved_members']))
echo '
' , $bullet , '<a href="', $scripturl, '?action=viewmembers;sa=browse;type=approve">'.$txt['tp_unapproved_members'].' '. $context['unapproved_members']  . '</a><br />';

if(isset($context['TPortal']['userbox']['unread']))
echo '
' , $bullet , '<a href="', $scripturl, '?action=unread">' .$txt['tp-unread'].'</a><br />
' , $bullet , '<a href="', $scripturl, '?action=unreadreplies">'.$txt['tp-replies'].'</a><br />
' , $bullet , '<a href="', $scripturl, '?action=profile;u='.$context['user']['id'].';sa=showPosts">'.$txt['tp-showownposts'].'</a><br />
' , $bullet , '<a href="', $scripturl, '?action=tpmod;sa=showcomments">'.$txt['tp-showcomments'].'</a><br />';

// Is the forum in maintenance mode?
if ($context['in_maintenance'] && $context['user']['is_admin'])
echo '
' , $bullet , $txt['tp_maintenace'] , '<br />';

echo '
</td>
<td>';

// admin parts etc.
if(!isset($context['TPortal']['can_submit_article']))
$context['TPortal']['can_submit_article']=0;

// do not show if none is availalable
if($context['TPortal']['can_submit_article']==1 || allowedTo(array('tp_dlupload','tp_dlmanager','tp_settings','tp_articles','tp_blocks','tp_submithtml','tp_submitbbc')))
{
// can we submit an article?
if(!allowedTo('tp_articles'))
{
          if(allowedTo('tp_submithtml'))
echo '
' , $bullet , '<a href="', $scripturl, '?action=tpmod;sa=submitarticle">' . $txt['tp-submitarticle']. '</a><br />';
   
if(allowedTo('tp_submitbbc'))
echo '
' , $bullet , '<a href="', $scripturl, '?action=tpmod;sa=submitarticle;bbc">' . $txt['tp-submitarticlebbc']. '</a><br />';
}

// upload a file?
       if(allowedTo('tp_dlupload') || allowedTo('tp_dlmanager'))
          echo '
' , $bullet , '<a href="', $scripturl, '?action=tpmod;dl=upload">' . $txt['permissionname_tp_dlupload']. '</a><br />';

// tpadmin checks
if (allowedTo('tp_settings'))
echo '
' , $bullet , '<a href="' . $scripturl . '?action=tpadmin;sa=settings">' . $txt['permissionname_tp_settings'] . '</a><br />';

if (allowedTo('tp_blocks'))
echo '
' , $bullet , '<a href="' . $scripturl . '?action=tpadmin;sa=blocks">' . $txt['permissionname_tp_blocks'] . '</a><br />';

if (allowedTo('tp_articles'))
{
echo '
' , $bullet , '<a href="' . $scripturl . '?action=tpadmin;sa=articles">' . $txt['permissionname_tp_articles'] . '</a><br />';

// any submissions?
if($context['TPortal']['submitcheck']['articles']>0)
echo '
' , $bullet , '<a href="' . $scripturl . '?action=tpadmin;sa=submission"><b>' . $context['TPortal']['submitcheck']['articles'] . ' ' .$txt['tp-articlessubmitted'] . '</b></a><br />';
}

if (allowedTo('tp_dlmanager'))
{
echo '
' , $bullet , '<a href="' . $scripturl . '?action=tpmod;dl=admin">' . $txt['permissionname_tp_dlmanager'] . '</a><br />';

// any submissions?
if($context['TPortal']['submitcheck']['uploads']>0)
echo '
' , $bullet , '<a href="' . $scripturl . '?action=tpmod;dl=adminsubmission"><b>' . $context['TPortal']['submitcheck']['uploads'] . ' ' .$txt['tp-dluploaded'] . '</b></a><br />';
}

}

// add adminhooks
if(sizeof($context['TPortal']['tpmodules']['adminhook'])>0)
{
foreach($context['TPortal']['tpmodules']['adminhook'] as $link)
echo $bullet , '<a href="' . $scripturl . '?'.$link['action'].'">' . $link['title']. '</a><br />';
}

echo '
</td>
</tr>';

// Stats....

echo '
<tr>
<td colspan="4">';

if(isset($context['TPortal']['userbox']['online']))
{
// add online users
echo '
<strong><a href="'.$scripturl.'?action=who">'.$txt[158].'</a></strong>
<div>';

$online = ssi_whosOnline('array');
echo $bullet , $txt['tp-users'].': '.$online['num_users']. '
' , $bullet , $txt['tp-guests'].': '.$online['guests'].'
' , $bullet , $txt['tp-total'].': '.$online['total_users'].'
<div style="max-height: 23em; overflow: auto;">';

foreach($online['users'] as $user)
{
echo $user['hidden'] ? '<span style="margin-left: 5px"><i>' . $user['link'] . '</i></span>' : '<span style="margin-left: 5px">' . $user['link'] . '</span>';
echo ' ';
}
echo '
</div>
</div>';
}

echo '
</td>
</tr>
</table>';
}
// Otherwise they're a guest - so politely ask them to register or login.
else
{
echo '
<div>', $txt['welcome_guest'], '</div>
<div class="smalltext">', $context['current_time'], '</div>
<form style="margin-top: 5px;" action="', $scripturl, '?action=login2" method="post" >
<input type="text" name="user" size="10" /> <input type="password" name="passwrd" size="10" /><br />
<select name="cookielength">
<option value="60">', $txt['smf53'], '</option>
<option value="1440">', $txt['smf47'], '</option>
<option value="10080">', $txt['smf48'], '</option>
<option value="302400">', $txt['smf49'], '</option>
<option value="-1" selected="selected">', $txt['smf50'], '</option>
</select>
<input type="submit" value="', $txt[34], '" />
</form>
<span class="smalltext">', $txt['smf52'], '</span>
<br />';
}

keith021773

That looks great Freddy!    Thanks for your hard work.   I appreciate it!

Job well done!

Freddy


keith021773

I really do like this block alot.   It's working great.   Just one small cosmetic problem.

When viewing the block in the forum, homepage and unread screens everything is fine, but when you go to a post, the bullets disappear.     Anyone know why this may be happening?

The code below is what we are using, we have tweaked it just alittle.   I will post screen shots of the problem too.


Freddy

Thanks for the screen shots.  I don't know why this is happening - I tried it on my test forum and it works fine in all sections.  Perhaps there is another mod interfering with it, but I can't see how it would.

It might be helpful to see this on your site live and then maybe we can figure it out that way, it would let me see the source code...

Once you have it up and running post us a link to a page where it is not working please.

Anyone else have any thoughts ?

IchBin

You have a temp account we can look at this with Keith?

keith021773

#29
Sure.


This website is proudly hosted on Crocweb Cloud Website Hosting.