MyBB Community Forums

Full Version: Check the user group externally
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Greetings,

I implemented a forum on my website and I already succeded in being able to login from the website instead of the forum.

Now, in my home page, depending on the type of user, I want to show links to the Admin CP, Mod CP and User CP, just the way MyBB displays on the forum after the user logs in.

I have been trying this:
if ($mybb->user['usergroup'] == 1)

In where '1' is the number of the user group on the database, but without sucess...

Also, I have tried using the function provided in this thread... But still, nothing Undecided


What am I missing here?
You need this plugin to allow php within templates: http://mybbhacks.zingaburga.com/showthread.php?tid=260

Then use:

<if $GLOBALS['mybb']->user['usergroup'] == 1 then>

//Do something here

</if>
Well... the user group is still 1... Even if I'm logged on an Administrator account.

This is on the beginning of the page
<?php
    $forumpath = 'forum/';

    chdir($forumpath);
    define("IN_MYBB", 1);
    require('../forum/global.php');
    require_once MYBB_ROOT."inc/class_parser.php";
    $parser = new postParser;
    chdir('../');
?>

However, I don't believe that
<if $GLOBALSmybb']->user['usergroup'] == 1 then>
is correct. See, in Netbeans, I get a red undeline underneath the '$'... Maybe I need to import something?
(2012-05-22, 11:44 PM)Sïgma Wrote: [ -> ]However, I don't believe that
<if $GLOBALSmybb']->user['usergroup'] == 1 then>
is correct. See, in Netbeans, I get a red undeline underneath the '$'... Maybe I need to import something?

(2012-05-22, 11:19 PM)Frank.Barry Wrote: [ -> ]
<if $GLOBALS['mybb']->user['usergroup'] == 1 then>

Typo. You missed off [' in front of mybb.