Created
March 1, 2015 20:46
-
-
Save amdrew/e9b91a706c540ac08430 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$affiliate_wp = affiliate_wp(); | |
remove_shortcode( 'affiliate_area', array( $affiliate_wp, 'affiliate_area' ) ); | |
add_shortcode( 'affiliate_area', 'affwp_custom_affiliate_area' ); | |
function affwp_custom_affiliate_area() { | |
ob_start(); | |
if( is_user_logged_in() && affwp_is_affiliate() ) { | |
affiliate_wp()->templates->get_template_part( 'dashboard' ); | |
} elseif( is_user_logged_in() && affiliate_wp()->settings->get( 'allow_affiliate_registration' ) ) { | |
affiliate_wp()->templates->get_template_part( 'register' ); | |
} else { | |
if ( ! is_user_logged_in() ) { | |
affiliate_wp()->templates->get_template_part( 'login' ); | |
} | |
if ( affiliate_wp()->settings->get( 'allow_affiliate_registration' ) ) { | |
affiliate_wp()->templates->get_template_part( 'register' ); | |
} else { | |
affiliate_wp()->templates->get_template_part( 'no', 'access' ); | |
} | |
} | |
return ob_get_clean(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment