Jump to content

If user is a affiliate code


Recommended Posts

hello,

 

1st 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}

Link to comment
Share on other sites

thanks sentq :)

 

i am curious if you know wether or not the affiliate page array already has the tblconfuration aff values or would i need to pull those down as well with a hook. I am about to do some digging but i thought i would ask in case its already there.

Link to comment
Share on other sites

i am curious if you know wether or not the affiliate page array already has the tblconfuration aff values or would i need to pull those down as well with a hook. I am about to do some digging but i thought i would ask in case its already there.

if you can explain what exactly do you need, or have an example so i can help you @durangod

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.

×
×
  • 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