MyBB Community Forums

Full Version: Hook to postbit?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
For some reason I can't hook to postbit post please help me?

$plugins->add_hook('postbit', 'test');

function test(&$post) {
    global $mybb, $test, $templates;  
	eval("\$test = \"".$templates->get("test_postbit")."\";");
}


In the postbit template I use {test} but nothing is showing?????
You have to do some other things like

function test(&$post) {
    global $mybb, $test, $templates;  

    $post['test'] = "My new test";
    $post['test2'] = "another test";

    eval("\$test = \"".$templates->get("test_postbit")."\";");
} 


Then you have to set on your test_postbit template.
TESTING NEW TEMPLATE
    One test: {$post['test']}<br />
    Second test: {$post['test2']}....

You have to see this content but i only use template when have a query results to add only a new var for every user, like new field on db or two new fields and get an array data on sql query then template get all data for you xD.
{$test} should work. Not {test}.
Thanks guys $post['something'] works great. Love to lean new stuff!