suredata Posted March 30, 2012 Share Posted March 30, 2012 Hi there, I'm trying to work out the best way to test if a logged in user is a customer or simply a member i.e. hasn't any domains or products/services active. The reasoning being that we want to hide the affiliates link making it only visible to customers i.e. those who actually use our products. Any thoughts on the best way to tackle this would be appreciated but my first thoughts are to add the count(*) from both tblhosting and tblproducts for the UID and then do a if > 0 call in the template. Is this feasible? And if so, any code samples would be appreciated. Regards, 0 Quote Link to comment Share on other sites More sharing options...
wsd Posted April 1, 2012 Share Posted April 1, 2012 Create this hooks file and place it here /whmcs/includes/hooks/update_client_status_inactive.php <?php function hook_update_client_status_inactive($vars) { update_query("tblclients",array("status"=>"Inactive"),array("id"=>$vars['userid'])); } add_hook("ClientAreaRegister",1,"hook_update_client_status_inactive"); ?> modify this file /whm/templates/your templates/header.tpl find <li><a href="affiliates.php">{$LANG.affiliatestitle}</a></li> and replace this with {if $clientsdetails.status eq Active} <li><a href="affiliates.php">{$LANG.affiliatestitle}</a></li> {/if} So, all newly created accounts from the customer side will be set as Inactive. So you can either choose to set the status to Active manually, or create an Action Hooks where you believe that the status must be changed to Active. 0 Quote Link to comment Share on other sites More sharing options...
wsd Posted July 15, 2012 Share Posted July 15, 2012 Just one example on how to set the customer active. Create this hooks file and place it here /whmcs/includes/hooks/update_invoicepaid_client_status_active.php <?php function update_invoicepaid_client_status_active($vars) { $invoiceid = $vars['invoiceid']; $Iid = mysql_query("SELECT userid FROM tblinvoices WHERE id=$invoiceid"); $Cid = mysql_fetch_array($Iid); update_query("tblclients",array("status"=>"Active"),array("id"=>$Cid['userid'])); } add_hook("InvoicePaid",1,"update_invoicepaid_client_status_active"); ?> 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.