JackRabbit Posted February 3, 2015 Share Posted February 3, 2015 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? 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Support Manager WHMCS John Posted February 4, 2015 WHMCS Support Manager Share Posted February 4, 2015 Hi, The correct syntax would be: {if $condlinks.affiliates} <img src="image_a"> {else} <img src="image_b"> {/if} Relevant documentation: http://docs.whmcs.com/Template_Syntax 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 4, 2015 Share Posted February 4, 2015 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} 0 Quote Link to comment Share on other sites More sharing options...
JackRabbit Posted February 4, 2015 Author Share Posted February 4, 2015 Ok, I tried both. Brian, your suggestion works great! Thank you both! 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.