Hi! I’m setting up a cool affiliate hub and it involves a whole page template. I want the page to be able to tell if users are affiliates or not, but I can’t do it in the template with your shortcodes. Please what is the right conditional to use to find out if someone is or is not an affiliate?
ie.
if(is_affilliate()) { do this }
Thanks!
That worked! Thank you very much
That does not seem to work.
Hi,
Sorry to interfere with Antonio, but there is a syntax error in the example … anyhow, this is how the shortcode [affiliates_is_affiliate] does it and it’s using a more appropriate API function:
if ( affiliates_user_is_affiliate( get_current_user_id() ) ) {
// do stuff
}
Cheers
Hi Ansley,
If you are using directly PHP, you can not use the shortcode. If you need to check if an user is an affiliate, you can use the ‘affiliates_get_user_affiliate’ function. Something like this:
$user_id = get_current_user_id();
$affiliate_ids = affiliates_get_user_affiliate( $user_id );
if ( $affiliates_ids !== null ) {
....
}
Kind Regards,
Antonio B.