MyBB Community Forums

Full Version: Quick PHP Question: How to set variable in function to a globalized array
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm modifying myBB's post variables
see below for an example:

//created my function in globals.php
Quote:function addmysig(){
global $post;
$post['messsage'] . = "<br> Blah! </b>";
}

//in functions_post.php where $post['message'] must have my special sig
Quote:......
$post['message'] = $parser->parse_message($post['message'], $parser_options);

addmysig();

I globalized already the $post array and i can use it already in function but somehow the actual variable $post['message'] outside the function isnt getting updated...

is this the right way to set variables to a global array from w/in a function??

regards
TJ
Make sure you global $post in build_postbit in inc/functions_post.php -- by default it isn't.

(If you use the plugin hooks in build_postbit you'll see that $post is passed by reference to the plugin function through the parameter.)
i see wat you mean thanks a lot!