Trax Posted October 18, 2014 Share Posted October 18, 2014 Hey, I need to either remove all links from whmcs client area or modify them so the will only show for a certain product group. What i'm trying to achieve is i offer free hosting and premium hosting packages. Free hosting clients are not provided with access to cPanel therefor i would not want these clients seeing the links to access cPanel from within whmcs, whereas for paying clients i would like them to see these links if possible? If not i will have no option put to remove all links from whmcs. Any ideas how i could do this? Thanks! 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted October 18, 2014 Share Posted October 18, 2014 Sure, it's possible. You could configure 2 products: Free Hosting, Premium Hosting. Let's say that Free Hosting ID is 12. Edit templates/{YOUR_TEMPLATE}/clientareaproductdetails.tpl. Now find the part that displays the "Login to cPanel" buttons (it depends on the template that you are using) and add an if statement like this one. {if $pid neq '12'} Login to cPanel codes {/if} In this way you are hiding the "Login to cPanel" part only for products with ID 12 aka Free Hosting. Anyway please keep in mind that an user with a bit of knowledge about cPanel is still able to login via example.com:2083 with his FTP credentials. 0 Quote Link to comment Share on other sites More sharing options...
Trax Posted October 18, 2014 Author Share Posted October 18, 2014 I'm using the default template, i might also be blind here but i can't see any code in the "clientareaproductdetails.tpl" for cPanel links? Cheers 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 18, 2014 Share Posted October 18, 2014 I don't think that you can do it for product groups without additional coding, but you should be able to for a list of products - or client groups if those free hosting users were assigned to their own client group... the template to modify is in modules/servers/cpanel/clientarea.tpl one way would be to change the first line from... {if $producttype=="hostingaccount"} to the following if you want to use a client group.. {if $producttype=="hostingaccount" and $clientsdetails.groupid neq 1} with this, client group 1 will not see the cpanel/webmail logins - everyone else will... or for a particular product... {if $producttype=="hostingaccount" and $pid neq 48} or multiple products... {if $producttype=="hostingaccount" and ($pid neq 48 and $pid neq 45)} logins will not be shown for products 45 & 48 - all other cpanel hosting products will. as this method, depending on your client template theme, might show an empty box in the clientareaproductdetails page, you could expand this further and display a specific message for free hosting clients instead... {if $producttype=="hostingaccount" and ($pid eq 48 or $pid eq 45)} There is no cPanel login option available on Free Hosting accounts. {elseif $producttype=="hostingaccount"} ... so products 45 & 48 (e.g your free hosting accounts) will see the message, other cpanel hosting products will see the logins. though if your site uses multiple languages, you should probably use language overrides for the above line. http://docs.whmcs.com/Language_Overrides 0 Quote Link to comment Share on other sites More sharing options...
Trax Posted October 18, 2014 Author Share Posted October 18, 2014 Only issue with client groups is that i would need to move them manually to a specific group, atleast thats what i believe as i cannot see a way to have it done automatically upon ordering? 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted October 18, 2014 Share Posted October 18, 2014 You could automate this thing with an action hook. Probably AfterModuleCreate or PreModuleCreate. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 18, 2014 Share Posted October 18, 2014 Only issue with client groups is that i would need to move them manually to a specific group, atleast thats what i believe as i cannot see a way to have it done automatically upon ordering? there is a module available to purchase that will do that automatically... http://forum.whmcs.com/showthread.php?45488-WHMCS-Set-Client-Groups but if you don't want to buy that or use a hook as Kian suggests, then you still have the option of adding a list of applicable products to the template as described above. 0 Quote Link to comment Share on other sites More sharing options...
Trax Posted October 18, 2014 Author Share Posted October 18, 2014 Thanks guys i've managed to do it via the modules/servers/cpanel/clientarea.tpl I now need to some how do the same for the "change password" tab which i believe is this? <div data-toggle="tab" id="tab2" class="tab-content"> <div class="row"> <div class="col30"> <div class="internalpadding"> <div class="styled_title"><h2>{$LANG.serverchangepassword}</h2></div> <p>{$LANG.serverchangepasswordintro}</p> </div> </div> <div class="col70"> <div class="internalpadding"> <form method="post" action="{$smarty.server.PHP_SELF}?action=productdetails#tab2"> <input type="hidden" name="id" value="{$id}" /> <input type="hidden" name="modulechangepassword" value="true" /> <fieldset class="onecol"> {if $username}<div class="control-group"> <label class="control-label" for="password">{$LANG.serverusername}/{$LANG.serverpassword}</label> <div class="controls"> {$username}{if $password} / {$password}{/if} </div> </div>{/if} <div class="control-group"> <label class="control-label" for="password">{$LANG.newpassword}</label> <div class="controls"> <input type="password" name="newpw" id="password" /> </div> </div> <div class="control-group"> <label class="control-label" for="confirmpw">{$LANG.confirmnewpassword}</label> <div class="controls"> <input type="password" name="confirmpw" id="confirmpw" /> </div> </div> <div class="control-group"> <label class="control-label" for="passstrength">{$LANG.pwstrength}</label> <div class="controls"> {include file="$template/pwstrength.tpl"} </div> </div> </fieldset> <div class="form-actions"> <input class="btn btn-primary" type="submit" name="submit" value="{$LANG.clientareasavechanges}" /> <input class="btn" type="reset" value="{$LANG.cancel}" /> </div> </form> </div> </div> </div> </div> What would be the best way to hide this from certain users? Many thanks 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 18, 2014 Share Posted October 18, 2014 that really depends who the certain users are and how you want to identify them... for the sake of simplicity, i'm going to assume it's the same people as previous - the free hosters... if it isn't, that won't matter as its just a case of you finding some way to identify these people! your quoted code is the content of the tab - what might be a better solution is to remove the password tab for these users - so replace the following (~line 24)... {if $modulechangepassword}<li id="tab1nav"><a href="#tab2" data-toggle="tab">{$LANG.serverchangepassword}</a></li>{/if} with... {if $modulechangepassword and ($pid neq 48 and $pid neq 45)}<li id="tab1nav"><a href="#tab2" data-toggle="tab">{$LANG.serverchangepassword}</a></li>{/if} so if a client has products 48 or 45, the password tab is removed. if you're going down the road of removing the tab, then it might be worth doing the same for the other places they can do it - which from memory is the menu (Home/Services/Domains etc) and the pwreset.tpl template... there may be other pages too depending on your site. if you do this, one issue you probably will run into is that you won't have access to $pid on these pages - so you could query the db to find out, or use another existing variable - client group would be the obvious one. 0 Quote Link to comment Share on other sites More sharing options...
Trax Posted October 18, 2014 Author Share Posted October 18, 2014 Nice one guys, thank you very much for 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.