-
-
Save MyListingClub/e13fc99723e43fe25b8d3ebf88d50b4c to your computer and use it in GitHub Desktop.
register.php | AffiliateWP Registration Form
This file contains 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
//// INSTRUCTIONS: | |
//// 1.Browse to the MyListing Child Theme folder (/wp-content/themes/my-listing-child). | |
//// 2.Create a folder name 'affiliatewp'. | |
//// 3.Browse to the Affiliate WP templates folder (wp-content/plugins/affiliate-wp/templates). | |
//// 4.Copy 'register.php' into the MyListing Child Theme folder and edit the file as desired -or- | |
//// 5.Edit the file and copy in our pre-configured registration file template. | |
//// NOTES: | |
//// We are... | |
//// a. Adding asterisks to required fields | |
//// b. Removing fields that we don't need (Wes | |
---------------------------TEMPLATE IS BELOW THIS LINE--------------------------------------------------------- | |
<?php | |
global $affwp_register_redirect; | |
affiliate_wp()->register->print_errors(); | |
$errors = affiliate_wp()->register->get_errors(); | |
$required_registration_fields = affiliate_wp()->settings->get( 'required_registration_fields' ); | |
if ( ! is_user_logged_in() && ! empty( $errors ) ) { | |
if ( ! array_key_exists( 'empty_name', $errors ) ) { | |
$user_name = sanitize_text_field( $_POST['affwp_user_name'] ); | |
} | |
if ( ! array_key_exists( 'empty_username', $errors ) && ! array_key_exists( 'username_unavailable', $errors ) && ! array_key_exists( 'username_invalid', $errors ) ) { | |
$user_login = sanitize_text_field( $_POST['affwp_user_login'] ); | |
} | |
if ( ! array_key_exists( 'email_unavailable', $errors ) && ! array_key_exists( 'email_invalid', $errors ) ) { | |
$user_email = sanitize_text_field( $_POST['affwp_user_email'] ); | |
} | |
if ( ! array_key_exists( 'payment_email_invalid', $errors ) ) { | |
$payment_email = sanitize_text_field( $_POST['affwp_payment_email'] ); | |
} | |
$url = esc_url( $_POST['affwp_user_url'] ); | |
$method = sanitize_text_field( $_POST['affwp_promotion_method'] ); | |
} | |
if ( is_user_logged_in() ) { | |
$current_user = wp_get_current_user(); | |
$user_name = $current_user->user_firstname . ' ' . $current_user->user_lastname; | |
$user_login = $current_user->user_login; | |
$user_email = $current_user->user_email; | |
$url = $current_user->user_url; | |
$disabled = ' disabled="disabled"'; | |
} else { | |
$disabled = ''; | |
} | |
?> | |
<form id="affwp-register-form" class="affwp-form" action="" method="post"> | |
<?php | |
/** | |
* Fires at the top of the affiliate registration templates' form (inside the form element). | |
* | |
* @since 1.0 | |
*/ | |
do_action( 'affwp_affiliate_register_form_top' ); | |
?> | |
<fieldset> | |
<legend><?php _e( 'Register a new affiliate account', 'affiliate-wp' ); ?></legend> | |
<?php | |
/** | |
* Fires just before the affiliate registration templates' form fields. | |
* | |
* @since 1.0 | |
*/ | |
do_action( 'affwp_register_fields_before' ); | |
?> | |
<p> | |
<label for="affwp-user-name"><?php _e( 'Your Name *', 'affiliate-wp' ); ?></label> | |
<input id="affwp-user-name" type="text" name="affwp_user_name" value="<?php if( ! empty( $user_name ) ) { echo $user_name; } ?>" title="<?php esc_attr_e( 'Your Name', 'affiliate-wp' ); ?>" <?php echo affwp_required_field_attr( 'your_name' ); ?> /> | |
</p> | |
<p> | |
<label for="affwp-user-login"><?php _e( 'Username *', 'affiliate-wp' ); ?></label> | |
<input id="affwp-user-login" required="required" type="text" name="affwp_user_login" maxlength="60" value="<?php if( ! empty( $user_login ) ) { echo $user_login; } ?>" title="<?php esc_attr_e( 'Username', 'affiliate-wp' ); ?>"<?php echo $disabled; ?> /> | |
</p> | |
<p> | |
<label for="affwp-user-email"><?php _e( 'Account Email *', 'affiliate-wp' ); ?></label> | |
<input id="affwp-user-email" required="required" type="email" name="affwp_user_email" value="<?php if( ! empty( $user_email ) ) { echo $user_email; } ?>" title="<?php esc_attr_e( 'Email Address', 'affiliate-wp' ); ?>"<?php echo $disabled; ?> /> | |
</p> | |
<p> | |
<label for="affwp-payment-email"><?php _e( 'PayPal Email *', 'affiliate-wp' ); ?></label> | |
<input id="affwp-payment-email" type="email" name="affwp_payment_email" value="<?php if( ! empty( $payment_email ) ) { echo $payment_email; } ?>" title="<?php esc_attr_e( 'Payment Email Address', 'affiliate-wp' ); ?>"<?php echo affwp_required_field_attr( 'payment_email' ); ?> /> | |
</p> | |
<?php if ( ! is_user_logged_in() && isset( $required_registration_fields['password'] ) ) : ?> | |
<p> | |
<label for="affwp-user-pass"><?php _e( 'Password *', 'affiliate-wp' ); ?></label> | |
<input id="affwp-user-pass" required="required" class="password" type="password" name="affwp_user_pass" /> | |
</p> | |
<p> | |
<label for="affwp-user-pass2"><?php _e( 'Confirm Password *', 'affiliate-wp' ); ?></label> | |
<input id="affwp-user-pass2" required="required" class="password" type="password" name="affwp_user_pass2" /> | |
</p> | |
<?php endif; ?> | |
<?php | |
/** | |
* Fires just before the terms of service field within the affiliate registration form template. | |
* | |
* @since 1.0 | |
*/ | |
do_action( 'affwp_register_fields_before_tos' ); | |
?> | |
<?php $terms_of_use = affiliate_wp()->settings->get( 'terms_of_use' ); ?> | |
<?php if ( ! empty( $terms_of_use ) ) : ?> | |
<p> | |
<label class="affwp-tos" for="affwp-tos"> | |
<input id="affwp-tos" required="required" type="checkbox" name="affwp_tos" /> | |
<a href="<?php echo esc_url( get_permalink( affiliate_wp()->settings->get( 'terms_of_use' ) ) ); ?>" target="_blank"><?php echo affiliate_wp()->settings->get( 'terms_of_use_label', __( 'Agree to our Terms of Use and Privacy Policy', 'affiliate-wp' ) ); ?></a> | |
</label> | |
</p> | |
<?php endif; ?> | |
<?php if ( affwp_is_recaptcha_enabled() ) : | |
affwp_enqueue_script( 'affwp-recaptcha' ); ?> | |
<div class="g-recaptcha" data-sitekey="<?php echo esc_attr( affiliate_wp()->settings->get( 'recaptcha_site_key' ) ); ?>"></div> | |
<p> | |
<input type="hidden" name="g-recaptcha-remoteip" value="<?php echo esc_attr( affiliate_wp()->tracking->get_ip() ); ?>" /> | |
</p> | |
<?php endif; ?> | |
<?php | |
/** | |
* Fires inside of the affiliate registration form template (inside the form element, prior to the submit button). | |
* | |
* @since 1.0 | |
*/ | |
do_action( 'affwp_register_fields_before_submit' ); | |
?> | |
<p> | |
<input type="hidden" name="affwp_honeypot" value="" /> | |
<input type="hidden" name="affwp_redirect" value="<?php echo esc_url( $affwp_register_redirect ); ?>"/> | |
<input type="hidden" name="affwp_register_nonce" value="<?php echo wp_create_nonce( 'affwp-register-nonce' ); ?>" /> | |
<input type="hidden" name="affwp_action" value="affiliate_register" /> | |
<input class="button" type="submit" value="<?php esc_attr_e( 'Become An Ambassador', 'affiliate-wp' ); ?>" /> | |
</p> | |
<?php | |
/** | |
* Fires inside of the affiliate registration form template (inside the form element, after the submit button). | |
* | |
* @since 1.0 | |
*/ | |
do_action( 'affwp_register_fields_after' ); | |
?> | |
</fieldset> | |
<?php | |
/** | |
* Fires at the bottom of the affiliate registration form template (inside the form element). | |
* | |
* @since 1.0 | |
*/ | |
do_action( 'affwp_affiliate_register_form_bottom' ); | |
?> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment