Skip to content

Instantly share code, notes, and snippets.

@jprieton
Last active August 29, 2015 14:17
Show Gist options
  • Save jprieton/d9ba8016292c115dcbba to your computer and use it in GitHub Desktop.
Save jprieton/d9ba8016292c115dcbba to your computer and use it in GitHub Desktop.
Formulario de registro WordPress / JP Theme Tools
<form id="registerform" method="post" action="<?php home_url() ?>" name="loginform">
<div class="form-group">
<label for="user_login">Email</label>
<input type="text" class="form-control" name="user_login" id="user_login" placeholder="Tu email">
</div>
<div class="form-group">
<label for="user_password">Contraseña</label>
<input type="password" class="form-control" id="user_password" name="user_password" placeholder="Contraseña">
</div>
<div class="form-group">
<label for="verif_user_password">Verifica tu contraseña</label>
<input type="password" class="form-control" id="verif_user_password" name="verif_user_password" placeholder="Verifica tu contraseña">
</div>
<div class="row">
<button type="submit" class="btn btn-info btn-block .send-button">Registrarme</button>
</div>
<input type="hidden" name="action" value="user_register">
<?php wp_nonce_field('user_register') ?>
</form>
jQuery(function () {
if (typeof admin_url === 'undefined')
return false;
jQuery('#registerform').ajaxForm({
url: admin_url,
dataType: 'json',
beforeSubmit: function (formData, jqForm, options) {
jQuery('#registerform .send-button')
.attr('disabled', '')
.html('Enviando...');
},
success: function (responseText, statusText, xhr, $form) {
jQuery('#registerform .send-button')
.removeAttr('disabled');
if (responseText === 1) {
jQuery('#registerform .send-button').html('Éxito');
document.getElementById("registerform").reset();
} else {
jQuery('#registerform .send-button').html('Falló');
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment