Skip to content

Instantly share code, notes, and snippets.

@yousufansa
Created September 24, 2020 16:27
Show Gist options
  • Select an option

  • Save yousufansa/92db6c40c0da70ab7a6d3ecfa51a7f69 to your computer and use it in GitHub Desktop.

Select an option

Save yousufansa/92db6c40c0da70ab7a6d3ecfa51a7f69 to your computer and use it in GitHub Desktop.
Front Jobs - Candidate Register Form Shortcode
shortcode: `[front_child_candidate_register_form]`
if ( ! function_exists( 'front_child_candidate_account_job_register_form' ) ) {
function front_child_candidate_account_job_register_form() {
?><form method="post" class="register" <?php do_action( 'front_job_register_form_tag' ); ?> >
<?php do_action( 'front_job_register_form_start' ); ?>
<?php if ( get_option( 'users_can_register' ) ) : ?>
<div class="form-group">
<label class="form-label" for="reg_username"><?php esc_html_e( 'Username', 'front' ); ?>&nbsp;<span class="required">*</span></label>
<input type="text" class="form-control input-text" name="username" id="reg_username" autocomplete="username" value="<?php echo ( ! empty( $_POST['username'] ) ) ? esc_attr( wp_unslash( $_POST['username'] ) ) : ''; ?>" /><?php // @codingStandardsIgnoreLine ?>
</div>
<?php endif; ?>
<div class="form-group">
<label class="form-label" for="reg_email"><?php esc_html_e( 'Email address', 'front' ); ?></label>
<input type="email" class="form-control input-text" name="email" id="reg_email" autocomplete="email" value="<?php echo ( ! empty( $_POST['email'] ) ) ? esc_attr( wp_unslash( $_POST['email'] ) ) : ''; ?>" /><?php // @codingStandardsIgnoreLine ?>
</div>
<?php if ( apply_filters( 'front_job_register_password_enabled', true ) ) : ?>
<div class="form-group js-form-message">
<label class="form-label" for="reg_password"><?php esc_html_e( 'Password', 'front' ); ?></label>
<input id="reg_password" type="password" class="form-control input-text" name="password" aria-label="<?php esc_attr_e( 'Enter your password', 'front' ); ?>" required
data-msg="<?php esc_attr_e( 'Please enter your password.', 'front' ); ?>"
data-error-class="u-has-error"
data-success-class="u-has-success"
data-pwstrength-container="#changePasswordForm"
data-pwstrength-progress="#passwordStrengthProgress"
data-pwstrength-verdict="#passwordStrengthVerdict"
data-pwstrength-progress-extra-classes="bg-white height-4">
</div>
<div class="form-group">
<label class="form-label" for="con_password"><?php esc_html_e( 'Confirm Password', 'front' ); ?></label>
<input type="password" class="form-control input-text" name="confirmPassword" id="con_password" autocomplete="new-password" />
</div>
<?php else : ?>
<p><?php esc_html_e( 'A password will be sent to your email address.', 'front' ); ?></p>
<?php endif; ?>
<?php do_action( 'front_job_register_form' ); ?>
<?php
if ( isset( $_POST['register'] ) ) {
// show any error messages after form submission
front_show_error_messages();
}
?>
<div class="row align-items-center mb-5">
<div class="col-12 text-right justify-right">
<input type="hidden" name="front_user_role" value="candidate"/>
<input type="hidden" name="front_job_register_nonce" value="<?php echo wp_create_nonce('front_job-register-nonce'); ?>"/>
<input type="hidden" name="front_job_register_check" value="1"/>
<?php wp_nonce_field( 'ajax-register-nonce', 'register-security' ); ?>
<button type="submit" class="btn btn-primary transition-3d-hover button" name="register" value="<?php esc_attr_e( 'Register', 'front' ); ?>"><?php esc_html_e( 'Get Started', 'front' ); ?></button>
</div>
</div>
<?php do_action( 'front_job_register_form_end' ); ?>
</form><?php
}
}
add_shortcode( 'front_child_candidate_register_form' , 'front_child_candidate_account_job_register_form' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment