Jump to content

Recommended Posts

I'm trying to display an image on the client homepage if a client is not an active affiliate and a different image if a client is an active affiliate but I can't find the smarty variable and am not sure exactly how to create one using the whmcs docs.

 

I'm trying to do the following (of course the smarty is fictional, just an example of what I'm trying to do):

 

{if $activeaffiliate}
<img src="image_a">
{else}
<img src="image_b">
{/if}

 

What's the correct way to do this?

Link to comment
Share on other sites

Hi,

The correct syntax would be:

 

{if $condlinks.affiliates}
<img src="image_a">
{else}
<img src="image_b">
{/if}

are you sure, John? wouldn't that just detect if the affiliate system is on/off, rather than whether the logged in user was an affiliate or not? :?:

 

you could use the hook code posted by sentq in the thread below...

 

http://forum.whmcs.com/showthread.php?90262-If-user-is-a-affiliate-code

 

create new PHP file in /includes/hooks/ directory with any name like "checkifaffiliateisactive.php" and put the following code in it and save:

 

<?php
function hook_CheckIfAffiliateIsActive($vars){
   $valid = false;

   $getUser = full_query("SELECT `id` FROM `tblaffiliates` WHERE `clientid`='{$_SESSION['uid']}'");
   $getUser = mysql_num_rows($getUser);

   if ($getUser!='0'){
       $valid = true;
   }

return array('affiliateuser' => $valid);
}
add_hook("ClientAreaPage", 1, "hook_CheckIfAffiliateIsActive");
?>

 

then in any of your clientarea template files you can use the following IF Statement to check if the loggedin client is an affiliate user or not:

{if ($affiliateuser==true)}
This Part will displayed if client is registered as an Affiliate
{else}
This will be displayed for any one else
{/if}

I would imagine for you, this would be changed to...

 

{if $affiliateuser==true}
<img src="image_a">
{else}
<img src="image_b">
{/if}

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