MyBB Community Forums

Full Version: Hiding content for logged in
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello

I modified slightly plugin dvz shoutbox typing him a piece of code at the statistics, namely that looks, and now my question is how to hide the contents of these statistics for users not logged in, are caused by variables in the template index - the main page

function dvz_shoutbox_stats()
{
    global $db, $mybb, $templates, $theme, $wpisy, $users, $top_spamer, $users_online_o, $top_spamer_noformatted, $shshshs, $our_shouts, $timesearch, $shouts, $username, $user, $users_online, $anon_online, $invisiblemark, $onlinemembers, $guests_online, $spiders, $cache, $bots_online;

    // Statystyki

    $query = $db->query("SELECT count(id) as id FROM ".TABLE_PREFIX."dvz_shoutbox");

    $row = $db->fetch_array($query);
    $wpisy = $row['id'];

    $query3 = $db->query("SELECT d.uid, u.username, u.usergroup, u.displaygroup, u.uid, u.avatar, count(*) as shouters
                          FROM ".TABLE_PREFIX."dvz_shoutbox d
                          LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=d.uid)
                          GROUP BY d.uid
                          ORDER BY shouters
                          DESC LIMIT 1");
    $row3 = $db->fetch_array($query3);

    $shouts = $row3['shouters'];
    $top_spamer_noformatted = $row3['username'];
    $top_spamer = build_profile_link(format_name($row3['username'], $row3['usergroup'], $row3['displaygroup']), $row3['uid']);

    $query4 = $db->query("SELECT count(id) as id, uid FROM ".TABLE_PREFIX."dvz_shoutbox WHERE uid='".$mybb->user['uid']."'");

    $our_shouts = $db->fetch_field($query4, "id");
}
/* Not logged in */
if (!$mybb->user['uid'])
   die('You\'re not logged in.');
    if (!$mybb->user['uid'])
	$shouts = $row3['shouters'];
    $top_spamer_noformatted = $row3['username'];
    $top_spamer = build_profile_link(format_name($row3['username'], $row3['usergroup'], $row3['displaygroup']), $row3['uid']);
	); 
Something I can not really deal with that because it receives white Colleague
Refresh
instead of die() function, use error(), for example:

/* Not logged in */
if (!$mybb->user['uid'])
   error('You\'re not logged in.', 'Denied Access'); 
It is not a good solution because it would also have to use that style where you do not want to say there are no codes php