MyBB Community Forums

Full Version: remove welcomeblock not working...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I do not want to use find_replace_templates......

I wonder if I am using right hook?

<?php
/**
 * Mod Name: Remove Welcome Block 
 */


$plugins->add_hook("global_start", "removewelcome_header");
//$plugins->add_hook("global_end", "removewelcome_header");
//$plugins->add_hook("index_start", "removewelcome_header");


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

function removewelcome_info()
{
	return array(
		"name"				=> "Remove Welcome Block",
		"description"		=> "Remove Welcome Block",
		"website"			=> "",
		"author"			=> "ELY M.",
		"authorsite"		=> "",
		"version"			=> "1.0.3",
		"guid" => "",
		"compatibility" => "*"
		);
}

function removewelcome_activate()
{
}


function removewelcome_deactivate()
{
}


function removewelcome_header()
{

global $mybb, $cache, $lang, $templates;

echo "TESTHEADER";

/*
    $template = &$GLOBALS['templates']->cache['header'];
    $template = strtr($template, array(
    // two copies of this replacement for MyBB 1.4 (uses Windows newlines) and 1.6 (Nix newlines)
    '				{$welcomeblock}'."\r" => '<!-- stupid welcomeblock was here -->'."\r",
    '				{$welcomeblock}'."\n" => '<!-- stupid welcomeblock was here -->'."\n"
        ));
        
        
*/

if(!$templates->cache['header']) $templates->cache('header');
$templates->cache['header'] = str_replace('{$welcomeblock}', '<!-- stupid welcomeblock was here -->', $templates->cache['header']);


}





?>