Jump to content

Customer vs Member


suredata

Recommended Posts

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,

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 3 months later...

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");
?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

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