2021-03-11, 10:25 PM
I need to retrieve {$this_var} in template named "member_profile_avatar", but it doesn't allow me do that.
Near the top of plugin's code, I have:
...
$plugins->add_hook('member_profile_end', 'my_plugin_function');
...
And below in the same file, I have:
...
function my_plugin_function()
{
global $this_var;
echo "<script>console.log('Debug Objects:' );</script>";
$this_var = 'aaa';
}
...
This "$this_var" can be accessed from "member_profile" template.
However, "member_profile_avatar" template couldn't access that variable.
I also tried "index_start" instead of "member_profile_end", but it didn't work either.
How can I make a variable that can be accessed from any template?
Thank you very much!
Near the top of plugin's code, I have:
...
$plugins->add_hook('member_profile_end', 'my_plugin_function');
...
And below in the same file, I have:
...
function my_plugin_function()
{
global $this_var;
echo "<script>console.log('Debug Objects:' );</script>";
$this_var = 'aaa';
}
...
This "$this_var" can be accessed from "member_profile" template.
However, "member_profile_avatar" template couldn't access that variable.
I also tried "index_start" instead of "member_profile_end", but it didn't work either.
How can I make a variable that can be accessed from any template?
Thank you very much!