MyBB Community Forums

Full Version: Admin Log Help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The Admin Log seems like it is overwriting a string I'm sending to it. I'm using the admin_tools_get_admin_log_action hook. Here is my code

function socialgroups_admin_tools_get_admin_log_action()
{
    global $mybb, $db, $logitem, $lang_string;
    if($logitem['module'] == "user-social_groups")
    {
        $lang_string = "Edited Group # " . $logitem['data']['gid'] . " ( " . $logitem['data']['name']. " )";
    }
}

Yet it does not edit the string. I believe the fault is actually in the admin log file. The following is what I believe is the problem part.

$plugins->run_hooks("admin_tools_get_admin_log_action", $plugin_array);

	if(isset($lang->$lang_string))
	{
		array_unshift($logitem['data'], $lang->$lang_string); // First parameter for sprintf is the format string
		$string = call_user_func_array(array($lang, 'sprintf'), $logitem['data']);
		if(!$string)
		{
			$string = $lang->$lang_string; // Fall back to the one in the language pack
		}
	}
	else
	{
		// Build a default string
		$string = $logitem['module'].' - '.$logitem['action'];
		if(is_array($logitem['data']) && count($logitem['data']) > 0)
		{
			$string .= '('.implode(', ', $logitem['data']).')';
		}
	}
	return $string;
}

Any ideas?
I managed to solve it. What I did was change my function to this:

function socialgroups_admin_tools_get_admin_log_action()
{
    global $mybb, $db, $logitem, $lang_string;
    if($logitem['module'] == "user-social_groups")
    {
        $lang_string = "user_social_groups_admin_log";
    }
}

I then also created an admin language file that had the key admin_log_user_social_groups_manage_group.