Jump to content
JackRabbit

cpanel quick links on clientareahome.tpl

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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):?:

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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. :)

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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 ?

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites
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... :?:

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • By JelleG
      I want to define the position of the displayed blocks on the client area homepage.
      I want to use two columns, where I want to define what blocks are displayed inside these columns.
       
      By default to code is displayed using foreach, so I can not easily define the position of the blocks.
       
      Is there a way that I can check the menuItemName of some items with foreach and only display them?
       
      My currenty code is, which checks if the item is even or odd:
       

      {foreach $panels as $item} {if $item@iteration is odd} {outputHomePanels} {/if} {/foreach}
       
      I want to edit this, so that not the even or odd are displayed. But that I can define what item is displayed, based on the name of the item.
       
      Entire code:
       

      {function name=outputHomePanels} <div menuItemName="{$item->getName()}" class="panel panel-default panel-accent-{$item->getExtra('color')}{if $item->getClass()} {$item->getClass()}{/if} {$item->getName()}"{if $item->getAttribute('id')} id="{$item->getAttribute('id')}"{/if}> <div class="panel-heading"> <h3 class="panel-title"> {if $item->getExtra('btn-link') && $item->getExtra('btn-text')} <div class="pull-right"> <a href="{$item->getExtra('btn-link')}" class="more-link"> {$item->getExtra('btn-text')} </a> </div> {/if} <div class="clientarea-icon {$item->getName()}"> {if $item->hasIcon()}<i class="{$item->getIcon()}"></i>{/if} </div> <div class="clientarea-title"> {$item->getLabel()} </div> {if $item->hasBadge()}<span class="badge">{$item->getBadge()}</span>{/if} </h3> </div> {if $item->hasBodyHtml()} <div class="panel-body"> {$item->getBodyHtml()} </div> {/if} {if $item->hasChildren()} <div class="list-group{if $item->getChildrenAttribute('class')} {$item->getChildrenAttribute('class')}{/if}"> {foreach $item->getChildren() as $childItem} {if $childItem->getUri()} <a menuItemName="{$childItem->getName()}" href="{$childItem->getUri()}" class="list-group-item{if $childItem->getClass()} {$childItem->getClass()}{/if}{if $childItem->isCurrent()} active{/if}"{if $childItem->getAttribute('dataToggleTab')} data-toggle="tab"{/if}{if $childItem->getAttribute('target')} target="{$childItem->getAttribute('target')}"{/if} id="{$childItem->getId()}"> <div class="clientarea-icon {$childItem->getLabel()|stristr:'<' : true}"> <i class="icon-clientarea-product"></i> </div> <div class="clientarea-title"> {assign var="splitItem" value=" - "|explode:$childItem->getLabel()} {$splitItem[1]} </div> {if $childItem->hasBadge()} <span class="badge">{$childItem->getBadge()}</span>{/if} </a> {else} <div menuItemName="{$childItem->getName()}" class="list-group-item{if $childItem->getClass()} {$childItem->getClass()}{/if}" id="{$childItem->getId()}"> {if $childItem->hasIcon()}<i class="{$childItem->getIcon()}"></i> {/if} {$childItem->getLabel()} {if $childItem->hasBadge()} <span class="badge">{$childItem->getBadge()}</span>{/if} </div> {/if} {/foreach} </div> {/if} </div> {/function}
    • By Swapnil.mote
      All my clients are not able to login to the client area (clientarea.php) even reset a new password.
       
      Error message: Login Details Incorrect. Please try again.
       
       
      Please help.
       
      Thanks
  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated