WildcardSearch / Advanced-Sidebox

A plugin for MyBB forums that displays custom boxes on various forum pages.
GNU General Public License v3.0
20 stars 10 forks source link

Can't use certain variables in ASB templates #320

Open EatCleanEatCupcakes opened 6 years ago

EatCleanEatCupcakes commented 6 years ago

I've been trying to update the templates for the ASB to display certain information. Specficially, I've been trying to move the {$usercplink}, {$modcplink}, {$admincplink} into the welcome box, but find that nothing displays (whereas these work fine in other templates in myBB). Wondering if this isn't supported in ASB yet, or if there is something that needs to be done differently to use variables like these?

WildcardSearch commented 6 years ago

Hi @EatCleanEatCupcakes,

Those variables are globals, and while much of the core is coded in the global scope, plugins generally run most of their code from functions or classes. Any variables from the global scope that need to be accessed (eg. $mybb, $db, etc.) must be specifically listed in the code. Therefore, we would have to somehow predict that the admin would want to use those variables in order to make them available in module templates.

Instead of using those variables, it would be just as easy to use the link HTML directly:

<a href="{$mybb->settings['bburl']}/usercp.php" class="usercp">{$lang->welcome_usercp}</a>