JackRabbit Posted July 31, 2015 Share Posted July 31, 2015 Considering all of my clients use one hosting cpanel, I would like to put the cpanel quick links on the clientareahome.tpl so that they have access immediately after logging into my site. How can I call the overview.tpl to be used in the clientareahome.tpl? and because the links use the service.id to login to the cpanel, how can I call the correct {id} for the overview.tpl? At the moment, I've just coppied the code from the overview.tpl and pasted it into the clientareahome.tpl, so the quicklinks are showing up but I'm having trouble getting the {id} smarty to work. 0 Quote Link to comment Share on other sites More sharing options...
JackRabbit Posted July 31, 2015 Author Share Posted July 31, 2015 I've copied the overview.tpl to the same folder and renamed it quicklinks.tpl. I went inside the new file and deleted all of the div's except the quick links. I've included this new template to the top of my clientareahome.tpl {include file="modules/servers/cpanel/templates/quicklinks.tpl"} Now that I've got the links on the clientareahome.tpl, the links aren't going anywhere because the {id} smarty isn't being replaced with the hosting service id. How can I get this ID to populate with the hosting service id? (the active products and services home panel on the clientareahome.tpl is populating with the {id} I need but - I'm having trouble understanding how it works) 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 1, 2015 Share Posted August 1, 2015 what might help you is to add {debug} to the end of clientareahome.tpl - login as a client and you should get a popup window of the available Smarty variables and arrays. if what you want is in there, then you should be able to add it to your template... if it's not, then you'd need an action hook to query the database to add the correct variables/arrays to the page for the template to use. 0 Quote Link to comment Share on other sites More sharing options...
JackRabbit Posted August 4, 2015 Author Share Posted August 4, 2015 The {debug} window didn't have the $service.id variable I needed. I've gone over the whmcs hooks doccumentation and have been fiddling around with the hook for the last two days and it's so confusing for me, I can't get the service id variable to show up. I put in a support ticket and they told me they can't help with customization issues. How can I create a working hook to call the $service.id variable? 0 Quote Link to comment Share on other sites More sharing options...
Si Posted August 4, 2015 Share Posted August 4, 2015 Exactly the same response from support (and I paid for the escalation process). I feel like I'm wading through the dark now with these hooks and no documentation. I want to modify the side menu in the client area based on conditions, and have had to give up. Wish I was back on version 5. At least I could make the changes I needed. This 'third party template' lark from support is a joke. The principles are the same whatever the template. The changes I want to make are not major and could be easily achieved in version 5. These hooks in version 6 are a backward step in user friendliness. 0 Quote Link to comment Share on other sites More sharing options...
JackRabbit Posted August 4, 2015 Author Share Posted August 4, 2015 Exactly the same response from support (and I paid for the escalation process). I feel like I'm wading through the dark now with these hooks and no documentation. I want to modify the side menu in the client area based on conditions, and have had to give up. Wish I was back on version 5. At least I could make the changes I needed. This 'third party template' lark from support is a joke. The principles are the same whatever the template. The changes I want to make are not major and could be easily achieved in version 5. These hooks in version 6 are a backward step in user friendliness. Si, assuming your "conditions modifications" worked with version 5, the only change that may cause your problem is the upgrade from smarty 2 to 3. The hooks stay the same through each version. Did you enable the php tags? Setup > General Settings > Security > check "Allow Smarty PHP Tags" (it's unchecked by default after upgrading to 6) documentation about hooks: http://docs.whmcs.com/Hooks documentation for conditions: http://docs.whmcs.com/Template_Syntax If that doesn't work or you can't find what you're looking for, will you use a separate thread for your problem? This threads subject is completely different. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 4, 2015 Share Posted August 4, 2015 The {debug} window didn't have the $service.id variable I needed. I've gone over the whmcs hooks doccumentation and have been fiddling around with the hook for the last two days and it's so confusing for me, I can't get the service id variable to show up. I put in a support ticket and they told me they can't help with customization issues. How can I create a working hook to call the $service.id variable? as a temporary measure, add the following code to the top of clientareahome.tpl... {php} $smartyvars = $template->getTemplateVars(); $userid = $smartyvars['clientsdetails']['id']; $query = mysql_query("SELECT *,tblhosting.id as serviceid FROM tblhosting,tblproducts WHERE userid = $userid AND tblhosting.packageid = tblproducts.id AND tblhosting.domainstatus='Active'"); $result = mysql_fetch_array($query); $services = $result["serviceid"]; $template->assign('serviceid', $services); {/php} {include file="modules/servers/cpanel/templates/quicklinks.tpl"} you'll need to ensure that you have enabled {php} tags from setup -> general settings -> security this will provide you with a valid $serviceid variable, assuming the client only has one account, that can be accessed by the quicklinks file for its cpanel links.. if you want to do this long-term, you'll still need to use an action hook - but I doubt {php} tags / mysql_query will be removed this year, so it gives you a little time to test if the idea of moving the quicklinks to the homepage works... and if so, then you can write the hook at your leisure. 0 Quote Link to comment Share on other sites More sharing options...
JackRabbit Posted August 4, 2015 Author Share Posted August 4, 2015 You're awesome Brian, it works. 0 Quote Link to comment Share on other sites More sharing options...
JackRabbit Posted February 6, 2016 Author Share Posted February 6, 2016 Brian, your solution works great until a user get's another service other than hosting, for example an SSL certificate. After getting the new service, the user clicks on the quicklinks and rather than logging them into cpanel, it takes them to the new service with a an error message that tells them they could not be logged in. The {$serviceid} variable is switching to the newer service id rather than the hosting service id. Is there a way to call the hosting service id only? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 6, 2016 Share Posted February 6, 2016 if you run the above SQL query in phpmyadmin, on a client that has a SSL cert, are there any different values (e.g server or packageid) that apply only to the SSL product and not other hosting ? 0 Quote Link to comment Share on other sites More sharing options...
JackRabbit Posted February 10, 2016 Author Share Posted February 10, 2016 Yes, there are a few differences. I have 3 ssl options and 3 hosting options so would packageid be useful? I'm not a genius with this. Here are some differences. packageid: hosting = 1 | ssl = 5 gid: hosting = 1 | ssl = 2 servertype: hosting = cpanel | ssl = enomssl type: hosting = hostingaccount | ssl = other on a client that has a SSL cert, are there any different values that apply only to the SSL product and not other hosting ? configoption4: hosting = (empty value) | ssl = 1 Is this what you mean? Does any of this help? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 10, 2016 Share Posted February 10, 2016 Is this what you mean? Does any of this help? can you try it using a tweaked sql query either in the {php} tags or as an action hook... {php} tags... {php} $smartyvars = $template->getTemplateVars(); $userid = $smartyvars['clientsdetails']['id']; $query = mysql_query("SELECT tblhosting.id as serviceid FROM tblhosting,tblproducts WHERE userid = $userid AND tblhosting.packageid = tblproducts.id AND tblhosting.domainstatus = 'Active' AND tblproducts.servertype = 'cpanel'"); $result = mysql_fetch_array($query); $services = $result["serviceid"]; $template->assign('serviceid', $services); {/php} or as a hook, you could use... <?php function jackrabbit_serviceid_hook($vars) { $userid = $_SESSION['uid']; $query = mysql_query("SELECT tblhosting.id as serviceid FROM tblhosting,tblproducts WHERE userid = $userid AND tblhosting.packageid = tblproducts.id AND tblhosting.domainstatus = 'Active' AND tblproducts.servertype = 'cpanel'"); $result = mysql_fetch_array($query); $services = $result["serviceid"]; $return = array("serviceid" => $services); return $return; } add_hook('ClientAreaPageHome', 1, 'jackrabbit_serviceid_hook'); ?> as it stands, $serviceid will contain one value, e.g the first cpanel product ID it finds in the query - i'm assuming your clients only have one cpanel hosting product and so this won't matter... if they had multiple cpanel products, it would be simple enough to change the hook to generate an array of values instead of just one, which you could then output via a {foreach} in the template - but let's not describe how to do that in detail unless we need to! i'm also assuming you only want to offer the cpanel quicklinks to cpanel products... 1 Quote Link to comment Share on other sites More sharing options...
JackRabbit Posted February 10, 2016 Author Share Posted February 10, 2016 Great, that works, thank you Brian! I'm using an if statement that will display the quick links on the homepage only if the client has one active hosting. The cpanel links are the only links I'd like there so your code works perfect. Thank you so much for all your help! 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.