MyBB Community Forums

Full Version: Reply in CuteNews with MyBB
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys.
Here I show you how to reply a news powered by CuteNews in your site with a MyBB user.
You have to go to your cutenews directory and then go to "core" dir and edit file "core.php".

At line 2132 you have this:
function member_get()
{
    // Not authorized
    if (empty($_SESSION['user']))
    {
        return NULL;
    }

    // No in cache
    if ($member = mcache_get('#member'))
    {
        return $member;
    }

    mcache_set('#member', $user = db_user_by_name($_SESSION['user']));
} 

change it with:
function member_get()
{
    global $mybb;
   
    if(defined("IN_MYBB")) {
        $_SESSION['user'] = $mybb->user['username'];
        $member = mcache_get('#member');
        mcache_set('#member', $member = db_user_by_name($_SESSION['user']));

        if($mybb->user['uid']) {
            $member['id'] = $mybb->user['uid'];
            $member['name'] = $mybb->user['username'];
            $member['email'] = $mybb->user['email'];
            $member['acl'] = 1;
        }

        return $member;
    }
    else {
        // Not authorized
        if (empty($_SESSION['user']))
        {
            return NULL;
        }

        // No in cache
        if ($member = mcache_get('#member'))
        {
            return $member;
        }

        mcache_set('#member', $user = db_user_by_name($_SESSION['user']));
        return $user;
    }
    
} 

Then in the page where you want to show news you have to add this before include news file:
define("IN_MYBB", 1);
include("global.php");

If that doesn't work you have to change cookie path to "/"

P.S: Sorry for the bad english
At least post some preview mate, who the hell would make this without preview.
This works. It allows you to use your mybb account to post news in cutenews. It's not really something worth doing tho. I would look more into mybb and wordpress tho