Skip to content

Instantly share code, notes, and snippets.

@amdrew
Created March 1, 2015 20:46
Show Gist options
  • Save amdrew/e9b91a706c540ac08430 to your computer and use it in GitHub Desktop.
Save amdrew/e9b91a706c540ac08430 to your computer and use it in GitHub Desktop.
<?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