Not Solved Is there anyway to pull the user's username to use outside the /forums/ directory
#3
Not Solved
(2016-11-30, 09:01 PM)dragonexpert Wrote: What you will need to do is include the global.php file from the directory your forum is installed in.  Do note that you will need to define the constant IN_MYBB as the value 1 or it will give you an error.

<?php
define("IN_MYBB", 1);
require_once "path_to_global.php";
if($mybb->user['uid']) {
$_SESSION['username'] = $mybb->user['username'];
}
else {
// Not logged in user.
}


Thanks for the reply. It's not setting the session, even if I'm currently logged into the forums. Does this need to be executed from a myBB template of some kind? I currently have it in it's own php block on a separate page. It's executing the code as the else result is firing, but the session isn't being set.
Reply


Messages In This Thread
RE: Is there anyway to pull the user's username to use outside the /forums/ directory - by contrad2 - 2016-12-01, 12:10 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)