[MyBB] Plugin, how cache read?

Hello!

How to read from the cache prefix from the last topic on the main page? Do you have to have some database query?

Now I like:

  <?php

// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
    die("Direct initialization of this file is not allowed.");
}


function prefix_index_info()
{
    return array (
        "name"          => "Prefix Thread On Index",
        "description"   => "",
        "website"       => "",
        "author"        => "Jose",
        "authorsite"    => "",
        "version"       => "0.1",
        "guid"          => "",
        "compatibility" => "*"
    );
}

function prefix_index_activate()
{

}

function prefix_index_deactivate()
{

}

$plugins->add_hook('build_forumbits_forum', 'prefix_index');
function prefix_index(&$forum)
{
	global $cache, $thread, $templates, $prefix;
	
	require_once MYBB_ROOT."inc/functions_forumlist.php";
	
	$prefix_index = $cache->read('threadprefixes');
	$prefix = '';
	
	if($thread['prefix'] && !empty($prefix_index[$thread['prefix']]))
	{
		$prefiks = $prefix_index[$thread['prefix']];
		$prefiks['prefix'] = htmlspecialchars_uni($prefiks['prefix']);
		$prefiks['displayname'] = htmlspecialchars_uni($prefiks['displayname']);
		$prefiks['forums'] = 2;
		eval('$prefix = "'.$templates->get('forumbit_depth2_forum_lastpost').'";');
	}
				

} 
?>

But unfortunately, nothing is displayed.
Does anyone have any suggestions? I cordially greet! :slight_smile:

I do not want to edit the file! http://community.mybb.com/thread-77229.html

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.