executable77 Posted June 17, 2021 Share Posted June 17, 2021 Hello, I'm trying to retreive some smarty variable in PHP. On WHMCS 7.7 I retrieved user email using : $email = $template->getVariable('clientsdetails')->value['email']; Now in the latest WHMCS version (8), I'm getting the following error : Quote Error: Call to a member function getVariable() on null in /var/www/template_c/7bb3185f7630a21a9cdaca2b3fb5131a64516058_0.file.custom_navbar.tpl.php:227Stack trace:#0 /var/www/html/example.com/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_60cb06b8dffb69_70745100()#1 /var/www/html/example.com/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode()#2 /var/www/html/example.com/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render()#3 /var/www/html/example.com/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(385): Smarty_Internal_Template->render()#4 /var/www/template_c/ebb211ea44228453b199618d0eda25e0bc50e166_0.file.header.tpl.php(47): Smarty_Internal_Template->_subTemplateRender()#5 /var/www/html/example.com/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_60c31e97b6e1f6_63496519()#6 /var/www/html/example.com/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode()#7 /var/www/html/example.com/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render()#8 /var/www/html/example.com/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(232): Smarty_Internal_Template->render()#9 /var/www/html/example.com/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(116): Smarty_Internal_TemplateBase->_execute()#10 /var/www/html/example.com/vendor/whmcs/whmcs-foundation/lib/Smarty.php(0): Smarty_Internal_TemplateBase->fetch()#11 /var/www/html/example.com/vendor/whmcs/whmcs-foundation/lib/ClientArea.php(0): WHMCS\Smarty->fetch()#12 /var/www/html/example.com/vendor/whmcs/whmcs-foundation/lib/ClientArea.php(0): WHMCS\ClientArea->outputWithoutExit()#13 /var/www/html/example.com/vendor/whmcs/whmcs-foundation/lib/Http/Message/AbstractViewableResponse.php(0): WHMCS\ClientArea->getOutputContent()#14 /var/www/html/example.com/vendor/laminas/laminas-httphandlerrunner/src/Emitter/SapiEmitter.php(41): WHMCS\Http\Message\AbstractViewableResponse->getBody()#15 /var/www/html/example.com/vendor/laminas/laminas-httphandlerrunner/src/Emitter/SapiEmitter.php(31): Laminas\HttpHandlerRunner\Emitter\SapiEmitter->emitBody()#16 /var/www/html/example.com/index.php(0): Laminas\HttpHandlerRunner\Emitter\SapiEmitter->emit()#17 {main} Thanks 0 Quote Link to comment Share on other sites More sharing options...
ballisticviral Posted February 17, 2023 Share Posted February 17, 2023 $email = $template->getTemplateVars('clientsdetails')['email']; Try with the code above. 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.