2008-08-02, 02:29 PM
I was just making the who's online function for a plugin which hooks into the misc.php file. So I have to look with the $parameters variable. But, the problem is that you can't request that variable. It's made in the function called fetch_wol_activity(), and this means it isn't available in an other plugin, except with the follow file-change:
Open inc/functions_online.php and find:
Replace with:
Possible to include this by default?
Found a second problem:
In the build_friendly_wol_location() function, the needed threads are loaded, and that works perfect. You have chosen for static variables, so the threads are only loaded once.
But, a static variable isn't available in an other function/class. This means you can't use it in an other plugin.
To fix it, open inc/functions_online.php and find:
Replace with:
Or, you can add them in the array passed to the hook (L 865).
Open inc/functions_online.php and find:
function fetch_wol_activity($location)
{
global $uid_list, $aid_list, $pid_list, $tid_list, $fid_list, $eid_list, $plugins, $user;
Replace with:
function fetch_wol_activity($location)
{
global $uid_list, $aid_list, $pid_list, $tid_list, $fid_list, $eid_list, $plugins, $user, $parameters;
Possible to include this by default?
Found a second problem:
In the build_friendly_wol_location() function, the needed threads are loaded, and that works perfect. You have chosen for static variables, so the threads are only loaded once.
But, a static variable isn't available in an other function/class. This means you can't use it in an other plugin.
To fix it, open inc/functions_online.php and find:
function build_friendly_wol_location($user_activity, $return=false)
{
global $db, $lang, $uid_list, $aid_list, $pid_list, $tid_list, $fid_list, $eid_list, $plugins, $parser, $mybb;
static $threads, $forums, $forums_linkto, $posts, $events, $users, $attachments;
Replace with:
function build_friendly_wol_location($user_activity, $return=false)
{
global $db, $lang, $uid_list, $aid_list, $pid_list, $tid_list, $fid_list, $eid_list, $plugins, $parser, $mybb;
global $threads, $forums, $forums_linkto, $posts, $events, $users, $attachments;
Or, you can add them in the array passed to the hook (L 865).