actionhosting Posted January 6, 2021 Share Posted January 6, 2021 Hello I am having an issue in the client area, when users select a smartermail service, they get Something went wrong and we couldn't process your request. with this info Error: Call to a member function getTemplateVars() on null in /var/www/vhosts/billing.wsigenesis.com/whmcsdata/templates_c/6168120062068525cbc19f8fd94a9d6e8c6ab6ae_0.file.clientarea.tpl.php:25 Stack trace: 0 /var/www/vhosts/billing.wsigenesis.com/httpdocs/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_5ff3743078b550_78353019() 1 /var/www/vhosts/billing.wsigenesis.com/httpdocs/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode() 2 /var/www/vhosts/billing.wsigenesis.com/httpdocs/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render() 3 /var/www/vhosts/billing.wsigenesis.com/httpdocs/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(232): Smarty_Internal_Template->render() 4 /var/www/vhosts/billing.wsigenesis.com/httpdocs/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(116): Smarty_Internal_TemplateBase->_execute() 5 /var/www/vhosts/billing.wsigenesis.com/httpdocs/vendor/whmcs/whmcs-foundation/lib/Smarty.php(0): Smarty_Internal_TemplateBase->fetch() 6 /var/www/vhosts/billing.wsigenesis.com/httpdocs/vendor/whmcs/whmcs-foundation/lib/ClientArea.php(0): WHMCS\Smarty->fetch() 7 /var/www/vhosts/billing.wsigenesis.com/httpdocs/clientarea.php(0): WHMCS\ClientArea->getSingleTPLOutput() WHMCS advise::: I have discovered a solution: you can allow the template object in Smarty Security policy as mentioned here: https://docs.whmcs.com/Smarty_Security_Policy#Supported_Policy_Settings_and_Values Here is an example of a working policy and template snippet using the $template object instead of getTemplateVars() that demonstrates this // minimum policy inside configuration.php $smarty_security_policy = array( 'system' => array( 'disabled_tags' => [], 'enabled_special_smarty_vars' => array( 'template_object', ), ), ); <!-- in the page's template --> {php} echo 'PHP Block: '; echo $template->tpl_vars['template']; echo "<br/>"; {/php} Template Variable: {$template}<br/> I trust that gives you a good starting point for your customisations. Does any one know where to add the above Thanks Brian 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 8, 2021 Share Posted January 8, 2021 On 06/01/2021 at 16:53, actionhosting said: Does any one know where to add the above it would go in the existing configuration.php file in the root of your WHMCS install... 0 Quote Link to comment Share on other sites More sharing options...
actionhosting Posted January 8, 2021 Author Share Posted January 8, 2021 Hello For me it was the smartermail server add on modules/servers/smartermail/smartermail.php edit this file and locate all lines with getTemplateVars() and comment it out as they do not work anyways since the smartermail code is very dated and there has not been any update for years. Doing this while the smartermail function will not work, but this is ok, at least the whmcs functions and it will eliminate the errors. Brian 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.