Emhope Posted October 26, 2016 Share Posted October 26, 2016 I am having an issue finding how to utilise variables that don't appear to be accessible in certain template files. eg. $registerdomainenabled is available on homepage.tpl but not available elsewhere. Is there an easy way to retrieve and/or set the status of this variable (true or false) on other template files? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 26, 2016 Share Posted October 26, 2016 the usual way would be to use Action Hooks - http://docs.whmcs.com/Hooks - the required information can usually be found by accessing existing variables or querying the database... e.g., if you wanted to make the value of $registerdomainenabled available on other client pages, you could use the hook below... equally, you could query the db for the same information. <?php function register_enabled_hook($vars) { global $CONFIG; $registerenabled = $CONFIG['AllowRegister']; if ($registerenabled == "on") { $registerenabled = TRUE; return array("registerenabled" => $registerenabled); } } add_hook("ClientAreaPage", 1, "register_enabled_hook"); ?> in practice, the above creates a new variable, $registerenabled, if the "Allow Clients to Register domains" checkbox is ticked in the settings. if it's unticked, then this new variable will not be created - thus working in exactly the same way as $registerdomainenabled. if you wanted to, you could tweak the hook code to call it $registerdomainenabled and replace the existing variable - but as things stand, on the homepage, you should have access to both variables; on other pages, you should only have access to this new one. 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.