MyBB Community Forums

Full Version: How to make this sidebox
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,how to make this sidebox on portal? Is the plugin?
[Image: 7JxLrSIv.jpg]
This sidebox should be default in your GenX template. But this is the default code


<html>
<head>
<title>{$mybb->settings['bbname']}</title>
{$headerinclude}
</head>
<body>
{$header}
<table width="100%" cellspacing="0" cellpadding="{$theme['tablespace']}" border="0" align="center">
<tr><td valign="top" width="200">
{$welcome}
{$pms}
{$search}
{$stats}
{$whosonline}

</td>
<td>&nbsp;</td>
<td valign="top">
{$announcements}
{$latestthreads}
</td>
</tr>
</table>
{$footer}
</body>
</html>
No,default is this:
[Image: 0DIqzpg2.jpg]
Like this:
[Image: 7JxLrSIv.jpg]
@adi19: I know you from MyBB Romania. Big Grin
Anyway, for avatar (in portal), you need a plugin! I think you can try to write a basic one by yourself. The rest can be made with some modifications of your templates.

For example, if you will paste in "portal.php" page - immediately after (line 57):
$plugins->run_hooks("portal_start");
the following code:
// If the user is known, get avatar
if($mybb->user['uid'] != 0)
{
    // set a maximum width (in px)
    $avatar_width = 50;
	
	$user_avatar = $mybb->settings['useravatar'];

    $query = $db->simple_select("users", "avatar AS user_avatar", "uid = ".(int)$mybb->user['uid']."");
    $result = $db->fetch_field($query, "user_avatar");
    
    if(!empty($result))
    {
        $user_avatar = htmlspecialchars_uni($result);
    }

    unset($result);
    $user_avatar_width = (int)$avatar_width."px";
    
    $useravatar = "<img src=\"".$user_avatar."\" alt=\"\" width=\"".$user_avatar_width."\"\" />";
}
then you will be able to display the avatar wherever you want in portal page, using {$uservatar}.

And... if you modify this template:
AdminCP->Templates->Templates&Style->Templates->YOUR TEMPLATE->portal->portal_welcome_membertext
similar with:
{$useravatar}<span class="smalltext"><em>{$lang->member_welcome_lastvisit}</em> {$lastvisit}<br />
{$lang->since_then}<br />
<strong>&raquo;</strong> {$lang->new_announcements}<br />
<strong>&raquo;</strong> {$lang->new_threads}<br />
<strong>&raquo;</strong> {$lang->new_posts}<br /><br />
<a href="{$mybb->settings['bburl']}/search.php?action=getnew">{$lang->view_new}</a><br /><a href="{$mybb->settings['bburl']}/search.php?action=getdaily">{$lang->view_todays}</a>
</span>
you will get something like in this image:
[Image: example.jpg]

Or you can ask for a real plugin in Plugin Requests section. Good luck!
You don't need a query for getting the current user's avatar. It's saved in the $mybb->user array. This would be the most optimised way to display it: http://community.mybb.com/thread-159826-...pid1104543 that also supports ACP settings like dimensions or default avatar.
How is the box supposed to look like for guests? If it wasn't for them, you could simply bash a few templates together from the "portal"-group :p

You will definitely need a plugin that applies different content depending on who's viewing the page.
I found myself solving!!