I wrote up this method while writing my Pastebin. It was an experiment mostly to not have to use as many globals in my main code. I think it turned out nice and easy. Knowing that SMF 3.0 will use OOP does not help as this is the least likely way this would be implanted in the code. At least this can act as a bridge at that time to the new code.
I should explain the _() method. I set this up so I could do a Singleton. It also allows me to use it in a sorta static method by doing “userInfo::_()->id;”. Nice quick and easy.
I could of wrote this like my smcFunc class, but choose otherwise on the fact I wanted to use it as a object rather than a static method. A setup like that should be possible, but I didn’t test that.
I never tested but I don’t think accessing multiple dimensional parts of the $user_info will work. Things like $user_info[‘group’] most likely won’t work here. I should add support to drill down into the array, but will save that for a later day.
* userInfo as a class. We kinda do a poor method, but its the best way for now.
public static $instanceID = 0;
public static function _()
if (self::$instanceID == 0)
self::$instanceID = new userInfo;
public function __set($key, $value)
$user_info[$key] = $value;
public function __get($key)
return isset($user_info[$key]) ? $user_info[$key] : null;
public function __isset($key)
public function __unset($key)