yggdrasil Posted October 8, 2014 Share Posted October 8, 2014 Does someone know if its possible to have whmcs template code in an external php page outside WHMCS? Creating custom pages in whmcs requires them to be inside the whmcs root folder but I need to implement the logged if condition outside whmcs on a specific page, so it should be displayed only if a whmcs user is logged in. Is this possible? Maybe linking the code directly to the whmcs path and including the PHP include functions into the page? If not I will have to use the api, but since whmcs is on the same domain I assume this should work. 0 Quote Link to comment Share on other sites More sharing options...
durangod Posted October 8, 2014 Share Posted October 8, 2014 The only thing i am aware of to try this is to use the js sessionStorage https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage there are some examples about a quarter way down the page // Save data to the current session's store sessionStorage.setItem("username", "John"); // Access some stored data alert( "username = " + sessionStorage.getItem("username")); i was going to try to use this awhile back (just never got to it) because i have a recruitment popup that comes up on the page after 2 min. And i wanted to stop that popup if the user was already logged in or on the reg page and i was going to try to use the storage to set a flag. But i never got around to the project its still on the list. So you might try that. 0 Quote Link to comment Share on other sites More sharing options...
yggdrasil Posted October 8, 2014 Author Share Posted October 8, 2014 But why exactly if it the page is using the same local server, php sessions and databases? I saw some modules of people that integrated whmcs with wordpress and other CMS as well, this means they had to pull the data somehow, said this I assume this is possible, since the data and even php sessions are stored in the same domain. I don't need anything fancy either just a basic conditional. I wonder how those modules did it since I'm sure this run outside whmcs. 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted October 8, 2014 Share Posted October 8, 2014 Let's say that I've my WHMCS installed on example.com and my Wordpress on a different domain/server like whatever.com. On my Wordpress I can create a page that gets/sends data from/to WHMCS via API. This is how you integrate an external page with WHMCS. In case WHMCS and Wordpress are on the same domain/server, unless there are no special settings on your webserver, you could try to require("relative/path/to/init.php"); and initialize Smarty. 0 Quote Link to comment Share on other sites More sharing options...
durangod Posted October 8, 2014 Share Posted October 8, 2014 +1 kian you can also include a hook file, i have not tried this on a seperate domain it may not be possible, but on the same domain you can create a hook in whmcs and then have those results captured in your external file which is along the same lines as what kian was saying. 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.