Results 1 to 3 of 3

Thread: Customer vs Member

  1. #1
    Join Date
    Aug 2011
    Posts
    5

    Default Customer vs Member

    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,

  2. #2
    Join Date
    Jun 2010
    Location
    Lige her
    Posts
    183

    Default This could be a solution

    Create this hooks file and place it here
    /whmcs/includes/hooks/update_client_status_inactive.php

    PHP Code:
    <?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
    PHP Code:
    <li><a href="affiliates.php">{$LANG.affiliatestitle}</a></li
    and replace this with

    PHP Code:
    {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.
    Best regards,
    WHMCS 5 | Customisable Packages | Live Chat | DirectAdmin | QuickPay | Joker | Netim

  3. #3
    Join Date
    Jun 2010
    Location
    Lige her
    Posts
    183

    Default

    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 Code:
    <?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");
    ?>
    Best regards,
    WHMCS 5 | Customisable Packages | Live Chat | DirectAdmin | QuickPay | Joker | Netim

Similar Threads

  1. New Member
    By osCreative in forum The Lounge
    Replies: 0
    Last Post: 08-29-11, 10:14 AM