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: 362
  • Total: 363
  • 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.

keith021773

Sounds great Freddy.   I appreciate it and thank you!

Freddy

Had some time to start on this, all the info takes up a lot of space - see what you think.  Might be better to reduce the font to the smaller one :

All I did was copy Bloc's code and rearrange how it displays...



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

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

echo'
<div class="tp_userblock">';


// If the user is logged in, display stuff like their name, new messages, etc.
if ($context['user']['is_logged'])
{
echo '
<h4>', $txt['hello_member'], ' ', $context['user']['name'], '</h4>
';

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

if(isset($context['TPortal']['userbox']['unread']))
echo '
' , $bullet , '<a href="', $scripturl, '?action=unread">' .$txt['tp-unread'].'</a>
' , $bullet , '<a href="', $scripturl, '?action=unreadreplies">'.$txt['tp-replies'].'</a>
' , $bullet , '<a href="', $scripturl, '?action=profile;u='.$context['user']['id'].';sa=showPosts">'.$txt['tp-showownposts'].'</a>
' , $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'];
// Show the total time logged in?
if (!empty($context['user']['total_time_logged_in']) && isset($context['TPortal']['userbox']['logged']))
{
echo '
' , $bullet , $txt['tp-loggedintime'] , $context['user']['total_time_logged_in']['days'] . $txt['tp-acronymdays']. $context['user']['total_time_logged_in']['hours'] . $txt['tp-acronymhours']. $context['user']['total_time_logged_in']['minutes'] .$txt['tp-acronymminutes'];
}
echo '
' , $bullet , $context['current_time'] , '<br />';

// 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>';
              if(allowedTo('tp_submitbbc'))
echo '
' , $bullet , '<a href="', $scripturl, '?action=tpmod;sa=submitarticle;bbc">' . $txt['tp-submitarticlebbc']. '</a>';
}
// upload a file?
            if(allowedTo('tp_dlupload') || allowedTo('tp_dlmanager'))
              echo '
' , $bullet , '<a href="', $scripturl, '?action=tpmod;dl=upload">' . $txt['permissionname_tp_dlupload']. '</a>';

// tpadmin checks
if (allowedTo('tp_settings'))
echo '
' , $bullet , '<a href="' . $scripturl . '?action=tpadmin;sa=settings">' . $txt['permissionname_tp_settings'] . '</a>';
if (allowedTo('tp_blocks'))
echo '
' , $bullet , '<a href="' . $scripturl . '?action=tpadmin;sa=blocks">' . $txt['permissionname_tp_blocks'] . '</a>';
if (allowedTo('tp_articles'))
{
echo '
' , $bullet , '<a href="' . $scripturl . '?action=tpadmin;sa=articles">' . $txt['permissionname_tp_articles'] . '</a>';
// 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>';
}
if (allowedTo('tp_dlmanager'))
{
echo '
' , $bullet , '<a href="' . $scripturl . '?action=tpmod;dl=admin">' . $txt['permissionname_tp_dlmanager'] . '</a>';
// 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>';
}

}
// 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>';
}
}
// 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 />';
}
if (!empty($context['user']['avatar']) && isset($context['TPortal']['userbox']['avatar']))
echo '<p>' , $context['user']['avatar']['image'] , '</p>';

echo '
</div>';


// STATS....

echo'
<div class="tp_statsblock">';

if(isset($context['TPortal']['userbox']['stats']))
// members stats
echo '
<h5 class="mlist"><a href="'.$scripturl.'?action=mlist">'.$txt[19].'</a></h5>

' , $bullet , $txt[488].': ' , isset($modSettings['memberCount']) ? $modSettings['memberCount'] : $modSettings['totalMembers'] , '
' , $bullet , $txt['tp-latest']. ': <a href="', $scripturl, '?action=profile;u=', $modSettings['latestMember'], '"><strong>', $modSettings['latestRealName'], '</strong></a>
';
if(isset($context['TPortal']['userbox']['stats_all']))
// more stats
echo '
<h5 class="stats"><a href="'.$scripturl.'?action=stats">'.$txt['tp-stats'].'</a></h5>

' , $bullet , $txt[489].': '.$modSettings['totalMessages']. '
' , $bullet , $txt[490].': '.$modSettings['totalTopics']. '
' , $bullet , $txt['tp-mostonline-today'].': '.$modSettings['mostOnlineToday'].'
' , $bullet , $txt['tp-mostonline'].': '.$modSettings['mostOnline'].'
('.timeformat($modSettings['mostDate']).')';

if(isset($context['TPortal']['userbox']['online']))
{
// add online users
echo '
<h5 class="online"><a href="'.$scripturl.'?action=who">'.$txt[158].'</a></h5>
<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'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
echo ' ';
}
echo '
</div></div>';
}
echo '
</div>';

ZarPrime

Nice freddy.  Good job.  I haven't tried it but I assume it's :up: :up:

Keith, if you try this, It might be nice to take a screenshot and modify you original post in this topic to attach it so that others can see what it looks like in case they want to use it.

ZarPrime

keith021773

Great job Freddy!   I truly appreciate it.

I have attached a pic of it like Prime suggested.

I will probably make a few changes with it so it will fit better into my site.     For instance move the Avatar to the left of PM.   Remove the stats area all together.  Remove total logged in time and the date and time. 

That should shrink it enough to where it would fit better.    What do you think?

Freddy

Yeah sure, do whatever you think works - it's pretty easy to adjust now you have the code.   I think I would remove the avatar myself - and maybe surround the whole thing in a DIV and try out smaller text using the class 'smalltext' I think it is.

Otherwise I am glad you found it useful :)

keith021773

Thanks again Freddy.   I'm not good at all with code.    How hard would it be to do this.

Hey User,
Avatar       New posts                         Upload file
                  Show replies                     Manage Settings
                  Show own replies             Manage Blocks
                  Show latest comments      All of the other ones.

Users Online    List here with more space between the names.


Would that be too hard?    Also have bullet points on each of the Links.  For instance New posts, show replies, upload files, manage blocks.   All of those.    Would that be too hard?

Freddy

So you want to remove the 'Members' bit and the 'Stats' bit ?

Looks easy enough....I'll see what I can come up with.  You are sure this is what you want ?

keith021773

Quote from: freddy888 on October 31, 2009, 03:16:23 PM
So you want to remove the 'Members' bit and the 'Stats' bit ?

Looks easy enough....I'll see what I can come up with.  You are sure this is what you want ?

LOL   I think so.    Can it be formatted the way I showed in the previous post?

Freddy

Okay then, try this :


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>
</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="3">';

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

Perfect Freddy!   That is much better and great!   I sure do appreciate your hard work on it.  If there is anything I can do for you, just ask!

One more question..  The empty space on the right, is there a way that I can add an ad to that blank space?   For instance maybe add to that space? 

What do you think?

This website is proudly hosted on Crocweb Cloud Website Hosting.