Version Description
- 20/09/2018 =
- Feature - Google reCaptcha on login form
- Feature - Templates for login form
- Feature - Enable/Disable remember me and lost password
- Add - Filter to process smart tags
- Tweak - Move login related settings from general to login options
Download this release
Release Info
Developer | wpeverest |
Plugin | User Registration – Custom Registration Form, Login Form And User Profile For WordPress |
Version | 1.4.7 |
Comparing to | |
See all releases |
Code changes from version 1.4.6 to 1.4.7
- assets/js/frontend/user-registration.js +18 -5
- assets/js/frontend/user-registration.min.js +1 -1
- includes/admin/settings/class-ur-settings-general.php +104 -23
- includes/class-ur-emailer.php +2 -0
- includes/class-ur-form-handler.php +7 -0
- includes/class-ur-shortcodes.php +2 -16
- includes/functions-ur-core.php +39 -0
- includes/functions-ur-template.php +1 -0
- includes/shortcodes/class-ur-shortcode-login.php +8 -2
- includes/shortcodes/class-ur-shortcode-my-account.php +6 -1
- package-lock.json +1 -1
- readme.txt +9 -1
- templates/myaccount/form-login.php +51 -10
- user-registration.php +2 -2
assets/js/frontend/user-registration.js
CHANGED
@@ -439,10 +439,23 @@
|
|
439 |
var google_recaptcha_user_registration;
|
440 |
var onloadURCallback = function () {
|
441 |
|
442 |
-
|
443 |
-
'sitekey': ur_google_recaptcha_code.site_key,
|
444 |
-
'theme': 'light',
|
445 |
-
'style': 'transform:scale(0.77);-webkit-transform:scale(0.77);transform-origin:0 0;-webkit-transform-origin:0 0;'
|
446 |
|
447 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
448 |
};
|
439 |
var google_recaptcha_user_registration;
|
440 |
var onloadURCallback = function () {
|
441 |
|
442 |
+
var node_recaptcha_register = jQuery( '.ur-frontend-form' ).find( 'form.register #ur-recaptcha-node #node_recaptcha_register' ).length;
|
|
|
|
|
|
|
443 |
|
444 |
+
if( node_recaptcha_register !== 0 ) {
|
445 |
+
google_recaptcha_user_registration = grecaptcha.render( 'node_recaptcha_register', {
|
446 |
+
'sitekey': ur_google_recaptcha_code.site_key,
|
447 |
+
'theme': 'light',
|
448 |
+
'style': 'transform:scale(0.77);-webkit-transform:scale(0.77);transform-origin:0 0;-webkit-transform-origin:0 0;'
|
449 |
+
});
|
450 |
+
}
|
451 |
+
|
452 |
+
var node_recaptcha_login = jQuery( '.ur-frontend-form' ).find( 'form.login .ur-form-row .ur-form-grid #ur-recaptcha-node #node_recaptcha_login' ).length;
|
453 |
+
|
454 |
+
if( node_recaptcha_login !== 0 ) {
|
455 |
+
grecaptcha.render( 'node_recaptcha_login', {
|
456 |
+
'sitekey': ur_google_recaptcha_code.site_key,
|
457 |
+
'theme': 'light',
|
458 |
+
'style': 'transform:scale(0.77);-webkit-transform:scale(0.77);transform-origin:0 0;-webkit-transform-origin:0 0;'
|
459 |
+
});
|
460 |
+
}
|
461 |
};
|
assets/js/frontend/user-registration.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){({$user_registration:e(".ur-frontend-form form.register"),init:function(){this.load_validation(),this.init_inputMask(),this.$user_registration.on("input validate change",".input-text, select, input:checkbox input:radio",this.validate_field)},init_inputMask:function(){"undefined"!=typeof e.fn.inputmask&&e(".ur-masked-input").inputmask()},load_validation:function(){if("undefined"==typeof e.fn.validate)return!1;e.validator.methods.email=function(e,r){var a=new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);return this.optional(r)||a.test(e)},this.$user_registration.each(function(){e(this).validate({errorClass:"user-registration-error",validClass:"user-registration-valid",errorPlacement:function(e,r){"radio"===r.attr("type")||"checkbox"===r.attr("type")?r.parent().parent().parent().append(e):r.is("select")&&r.attr("class").match(/date-month|date-day|date-year/)?0===r.parent().find("label.user-registration-error:visible").length&&r.parent().find("select:last").after(e):r.hasClass("urfu-file-input")?e.insertAfter(r.parent().parent()):e.insertAfter(r)},highlight:function(r,a,t){var i=e(r);i.closest(".form-row"),i.attr("name")},unhighlight:function(r,a,t){var i=e(r),s=i.closest(".form-row"),n=i.attr("name");"radio"===i.attr("type")||"checkbox"===i.attr("type")?s.find("input[name='"+n+"']").addClass(t).removeClass(a):i.addClass(t).removeClass(a),s.removeClass("user-registration-has-error")},submitHandler:function(e){return!1}})})},validate_field:function(r){e.extend(e.validator.messages,{required:user_registration_params.message_required_fields,url:user_registration_params.message_url_fields,email:user_registration_params.message_email_fields,number:user_registration_params.message_number_fields,confirmpassword:user_registration_params.message_confirm_password_fields});var a=e(this),t=a.closest(".form-row"),i=!0,s=t.is(".validate-required"),n=t.is(".validate-email"),u=r.type;if("input"===u&&t.removeClass("user-registration-invalid user-registration-invalid-required-field user-registration-invalid-email user-registration-validated"),"validate"===u||"change"===u){if(s&&("checkbox"!==a.attr("type")||a.is(":checked")?""===a.val()&&(t.removeClass("user-registration-validated").addClass("user-registration-invalid user-registration-invalid-required-field"),i=!1):(t.removeClass("user-registration-validated").addClass("user-registration-invalid user-registration-invalid-required-field"),i=!1)),n&&a.val()){new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i).test(a.val())||(t.removeClass("user-registration-validated").addClass("user-registration-invalid user-registration-invalid-email"),i=!1)}i&&t.removeClass("user-registration-invalid user-registration-invalid-required-field user-registration-invalid-email").addClass("user-registration-validated")}}}).init();var r=user_registration_params.ursL10n;e.fn.ur_form_submission=function(){return this.each(function(){var a=e(this),t=[],i=user_registration_params.form_required_fields,s={init:function(){},get_form_data:function(){var r=this,t=[],i=a.closest(".ur-frontend-form").find(".ur-form-grid").find(".ur-frontend-field"),s=new Array;e.each(i,function(){var i=e(this).attr("name");if(a.closest(".ur-frontend-form").find(".ur-form-grid").find('.ur-frontend-field[name="'+i+'"]').length<2){var n=r.get_fieldwise_data(e(this));t.push(n)}else e.inArray(i,s)<0&&s.push(i)});for(var n=0;n<s.length;n++){var u=a.closest(".ur-frontend-form").find(".ur-form-grid").find('.ur-frontend-field[name="'+s[n]+'"]'),o=(u.get(0).tagName.toLowerCase(),"undefined"!==u.eq(0).attr("type")?u.eq(0).attr("type"):"null"),d=new Array;if(e.each(u,function(){var r=e(this),a="";switch(r.get(0).tagName.toLowerCase()){case"input":switch(o){case"checkbox":case"radio":a=r.prop("checked")?r.val():"";break;default:a=r.val()}break;case"select":case"textarea":a=r.val()}""!==a&&d.push(a)}),"checkbox"==o)var F=JSON.stringify(d);else if("radio"==o)F=d[0];else F=u.val();var l=s[n];l=l.replace("[]","");var f={value:F,field_type:o,label:u.eq(0).attr("data-label"),field_name:l};t.push(f)}return e(document).trigger("user_registration_frontend_form_data_filter",[t]),t},get_fieldwise_data:function(r){var a={},s=r.get(0).tagName.toLowerCase(),n="undefined"!==r.attr("type")?r.attr("type"):"null",u=r.get(0).className.split(" ")[0];switch(a.value="",s){case"input":switch(n){case"checkbox":case"radio":a.value=r.prop("checked")?r.val():"";break;default:a.value=r.val()}break;case"select":a.value=r.val();break;case"textarea":switch(u){case"wysiwyg":tinyMCE.triggerSave(),a.value=r.val();break;default:a.value=r.val()}}return e(document).trigger("user_registration_frontend_form_data_render",[r,a]),a.field_type="undefined"!==r.eq(0).attr("type")?r.eq(0).attr("type"):"null",r.attr("data-label")!==undefined?a.label=r.attr("data-label"):"label"===r.prev().get(0).tagName.toLowerCase()?a.label=r.prev().text():a.label=a.field_type,r.attr("name")!==undefined&&""!==r.attr("name")?(a.field_name=r.attr("name"),a.field_name=a.field_name.replace("[]","")):a.field_name="",e.inArray(a.field_name,e.trim(i))>=0&&t.push(a.field_name),a},show_message:function(r,a,t){t.find(".ur-message").remove();var i=e('<div class="ur-message user-registration-'+a+'" id="ur-submit-message-node"/>');i.append(r),t.append(i)}},n={init:function(){this.form_submit_event()},form_submit_event:function(){e("form.register").on("submit",function(t){if(a.valid()){if(a.find(".user-registration-password-strength").length>0){var i=a.find(".user-registration-password-strength").attr("data-current-strength"),n=a.find(".user-registration-password-strength").attr("data-min-strength");if(parseInt(i,0)<parseInt(n,0))return!1}t.preventDefault();var u;try{u=JSON.stringify(s.get_form_data())}catch(l){u=""}var o=0;1===e(this).closest("form").find('input[name="ur-user-form-id"]').length&&(o=e(this).closest("form").find('input[name="ur-user-form-id"]').val());var d="0";1===e(this).closest("form").find('input[name="ur_frontend_form_nonce"]').length&&(d=e(this).closest("form").find('input[name="ur_frontend_form_nonce"]').val());var F={action:"user_registration_user_form_submit",security:user_registration_params.user_registration_form_data_save,form_data:u,form_id:o,ur_frontend_form_nonce:d};if(e(document).trigger("user_registration_frontend_before_form_submit",[F,a]),"undefined"!=typeof ur_google_recaptcha_code&&"1"===ur_google_recaptcha_code.is_captcha_enable){if(0===a.find("#g-recaptcha-response").val().length)return void s.show_message("<p>"+r.captcha_error+"</p>","error",a);grecaptcha.reset()}a.find(".ur-submit-button").find("span").addClass("ur-front-spinner"),e.ajax({url:user_registration_params.ajax_url,data:F,type:"POST",async:!0,beforeSend:function(){},complete:function(t){a.find(".ur-submit-button").find("span").removeClass("ur-front-spinner");var i=e('<ul class=""/>'),n="error";try{var u=e.parseJSON(t.responseText);"undefined"!=typeof u.success&&!0===u.success&&"undefined"!=typeof u.data.paypal_redirect&&(window.location=u.data.paypal_redirect),"undefined"!=typeof u.success&&!0===u.success&&(n="message"),"object"==typeof u.data.message&&e.each(u.data.message,function(){e("<li/>").text(this).appendTo(i)}),"message"===n&&(e(".user-registration-password-hint").remove(),e(".user-registration-password-strength").remove(),"admin_approval"==user_registration_params.login_option?i.append("<li>"+r.user_under_approval+"</li>"):"email_confirmation"==user_registration_params.login_option?i.append("<li>"+r.user_email_pending+"</li>"):"payment"==user_registration_params.login_option?i.append("<li>"+u.data.message+"</li>"):i.append("<li>"+r.user_successfully_saved+"</li>"),a[0].reset(),jQuery("#billing_country").trigger("change"),jQuery("#shipping_country").trigger("change"),""!==user_registration_params.redirect_url?window.setTimeout(function(){window.location=user_registration_params.redirect_url},1e3):"undefined"!=typeof u.data.auto_login&&u.data.auto_login&&location.reload())}catch(o){i.append("<li>"+o.message+"</li>")}s.show_message(i,n,a),e(document).trigger("user_registration_frontend_after_ajax_complete",[t.responseText,n,a])}})}})}};s.init(),n.init()})},e(function(){e("form.register").ur_form_submission();var r=e('.ur-frontend-form input[type="date"]');r.length>0&&r.addClass("flatpickr-field").attr("type","text").flatpickr()})}(jQuery);var google_recaptcha_user_registration,onloadURCallback=function(){google_recaptcha_user_registration=grecaptcha.render("node_recaptcha",{sitekey:ur_google_recaptcha_code.site_key,theme:"light",style:"transform:scale(0.77);-webkit-transform:scale(0.77);transform-origin:0 0;-webkit-transform-origin:0 0;"})};
|
1 |
+
!function(e){({$user_registration:e(".ur-frontend-form form.register"),init:function(){this.load_validation(),this.init_inputMask(),this.$user_registration.on("input validate change",".input-text, select, input:checkbox input:radio",this.validate_field)},init_inputMask:function(){"undefined"!=typeof e.fn.inputmask&&e(".ur-masked-input").inputmask()},load_validation:function(){if("undefined"==typeof e.fn.validate)return!1;e.validator.methods.email=function(e,r){var a=new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);return this.optional(r)||a.test(e)},this.$user_registration.each(function(){e(this).validate({errorClass:"user-registration-error",validClass:"user-registration-valid",errorPlacement:function(e,r){"radio"===r.attr("type")||"checkbox"===r.attr("type")?r.parent().parent().parent().append(e):r.is("select")&&r.attr("class").match(/date-month|date-day|date-year/)?0===r.parent().find("label.user-registration-error:visible").length&&r.parent().find("select:last").after(e):r.hasClass("urfu-file-input")?e.insertAfter(r.parent().parent()):e.insertAfter(r)},highlight:function(r,a,t){var i=e(r);i.closest(".form-row"),i.attr("name")},unhighlight:function(r,a,t){var i=e(r),n=i.closest(".form-row"),s=i.attr("name");"radio"===i.attr("type")||"checkbox"===i.attr("type")?n.find("input[name='"+s+"']").addClass(t).removeClass(a):i.addClass(t).removeClass(a),n.removeClass("user-registration-has-error")},submitHandler:function(e){return!1}})})},validate_field:function(r){e.extend(e.validator.messages,{required:user_registration_params.message_required_fields,url:user_registration_params.message_url_fields,email:user_registration_params.message_email_fields,number:user_registration_params.message_number_fields,confirmpassword:user_registration_params.message_confirm_password_fields});var a=e(this),t=a.closest(".form-row"),i=!0,n=t.is(".validate-required"),s=t.is(".validate-email"),u=r.type;if("input"===u&&t.removeClass("user-registration-invalid user-registration-invalid-required-field user-registration-invalid-email user-registration-validated"),"validate"===u||"change"===u){if(n&&("checkbox"!==a.attr("type")||a.is(":checked")?""===a.val()&&(t.removeClass("user-registration-validated").addClass("user-registration-invalid user-registration-invalid-required-field"),i=!1):(t.removeClass("user-registration-validated").addClass("user-registration-invalid user-registration-invalid-required-field"),i=!1)),s&&a.val()){new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i).test(a.val())||(t.removeClass("user-registration-validated").addClass("user-registration-invalid user-registration-invalid-email"),i=!1)}i&&t.removeClass("user-registration-invalid user-registration-invalid-required-field user-registration-invalid-email").addClass("user-registration-validated")}}}).init();var r=user_registration_params.ursL10n;e.fn.ur_form_submission=function(){return this.each(function(){var a=e(this),t=[],i=user_registration_params.form_required_fields,n={init:function(){},get_form_data:function(){var r=this,t=[],i=a.closest(".ur-frontend-form").find(".ur-form-grid").find(".ur-frontend-field"),n=new Array;e.each(i,function(){var i=e(this).attr("name");if(a.closest(".ur-frontend-form").find(".ur-form-grid").find('.ur-frontend-field[name="'+i+'"]').length<2){var s=r.get_fieldwise_data(e(this));t.push(s)}else e.inArray(i,n)<0&&n.push(i)});for(var s=0;s<n.length;s++){var u=a.closest(".ur-frontend-form").find(".ur-form-grid").find('.ur-frontend-field[name="'+n[s]+'"]'),o=(u.get(0).tagName.toLowerCase(),"undefined"!==u.eq(0).attr("type")?u.eq(0).attr("type"):"null"),d=new Array;if(e.each(u,function(){var r=e(this),a="";switch(r.get(0).tagName.toLowerCase()){case"input":switch(o){case"checkbox":case"radio":a=r.prop("checked")?r.val():"";break;default:a=r.val()}break;case"select":case"textarea":a=r.val()}""!==a&&d.push(a)}),"checkbox"==o)var l=JSON.stringify(d);else if("radio"==o)l=d[0];else l=u.val();var F=n[s];F=F.replace("[]","");var f={value:l,field_type:o,label:u.eq(0).attr("data-label"),field_name:F};t.push(f)}return e(document).trigger("user_registration_frontend_form_data_filter",[t]),t},get_fieldwise_data:function(r){var a={},n=r.get(0).tagName.toLowerCase(),s="undefined"!==r.attr("type")?r.attr("type"):"null",u=r.get(0).className.split(" ")[0];switch(a.value="",n){case"input":switch(s){case"checkbox":case"radio":a.value=r.prop("checked")?r.val():"";break;default:a.value=r.val()}break;case"select":a.value=r.val();break;case"textarea":switch(u){case"wysiwyg":tinyMCE.triggerSave(),a.value=r.val();break;default:a.value=r.val()}}return e(document).trigger("user_registration_frontend_form_data_render",[r,a]),a.field_type="undefined"!==r.eq(0).attr("type")?r.eq(0).attr("type"):"null",r.attr("data-label")!==undefined?a.label=r.attr("data-label"):"label"===r.prev().get(0).tagName.toLowerCase()?a.label=r.prev().text():a.label=a.field_type,r.attr("name")!==undefined&&""!==r.attr("name")?(a.field_name=r.attr("name"),a.field_name=a.field_name.replace("[]","")):a.field_name="",e.inArray(a.field_name,e.trim(i))>=0&&t.push(a.field_name),a},show_message:function(r,a,t){t.find(".ur-message").remove();var i=e('<div class="ur-message user-registration-'+a+'" id="ur-submit-message-node"/>');i.append(r),t.append(i)}},s={init:function(){this.form_submit_event()},form_submit_event:function(){e("form.register").on("submit",function(t){if(a.valid()){if(a.find(".user-registration-password-strength").length>0){var i=a.find(".user-registration-password-strength").attr("data-current-strength"),s=a.find(".user-registration-password-strength").attr("data-min-strength");if(parseInt(i,0)<parseInt(s,0))return!1}t.preventDefault();var u;try{u=JSON.stringify(n.get_form_data())}catch(F){u=""}var o=0;1===e(this).closest("form").find('input[name="ur-user-form-id"]').length&&(o=e(this).closest("form").find('input[name="ur-user-form-id"]').val());var d="0";1===e(this).closest("form").find('input[name="ur_frontend_form_nonce"]').length&&(d=e(this).closest("form").find('input[name="ur_frontend_form_nonce"]').val());var l={action:"user_registration_user_form_submit",security:user_registration_params.user_registration_form_data_save,form_data:u,form_id:o,ur_frontend_form_nonce:d};if(e(document).trigger("user_registration_frontend_before_form_submit",[l,a]),"undefined"!=typeof ur_google_recaptcha_code&&"1"===ur_google_recaptcha_code.is_captcha_enable){if(0===a.find("#g-recaptcha-response").val().length)return void n.show_message("<p>"+r.captcha_error+"</p>","error",a);grecaptcha.reset()}a.find(".ur-submit-button").find("span").addClass("ur-front-spinner"),e.ajax({url:user_registration_params.ajax_url,data:l,type:"POST",async:!0,beforeSend:function(){},complete:function(t){a.find(".ur-submit-button").find("span").removeClass("ur-front-spinner");var i=e('<ul class=""/>'),s="error";try{var u=e.parseJSON(t.responseText);"undefined"!=typeof u.success&&!0===u.success&&"undefined"!=typeof u.data.paypal_redirect&&(window.location=u.data.paypal_redirect),"undefined"!=typeof u.success&&!0===u.success&&(s="message"),"object"==typeof u.data.message&&e.each(u.data.message,function(){e("<li/>").text(this).appendTo(i)}),"message"===s&&(e(".user-registration-password-hint").remove(),e(".user-registration-password-strength").remove(),"admin_approval"==user_registration_params.login_option?i.append("<li>"+r.user_under_approval+"</li>"):"email_confirmation"==user_registration_params.login_option?i.append("<li>"+r.user_email_pending+"</li>"):"payment"==user_registration_params.login_option?i.append("<li>"+u.data.message+"</li>"):i.append("<li>"+r.user_successfully_saved+"</li>"),a[0].reset(),jQuery("#billing_country").trigger("change"),jQuery("#shipping_country").trigger("change"),""!==user_registration_params.redirect_url?window.setTimeout(function(){window.location=user_registration_params.redirect_url},1e3):"undefined"!=typeof u.data.auto_login&&u.data.auto_login&&location.reload())}catch(o){i.append("<li>"+o.message+"</li>")}n.show_message(i,s,a),e(document).trigger("user_registration_frontend_after_ajax_complete",[t.responseText,s,a])}})}})}};n.init(),s.init()})},e(function(){e("form.register").ur_form_submission();var r=e('.ur-frontend-form input[type="date"]');r.length>0&&r.addClass("flatpickr-field").attr("type","text").flatpickr()})}(jQuery);var google_recaptcha_user_registration,onloadURCallback=function(){0!==jQuery(".ur-frontend-form").find("form.register #ur-recaptcha-node #node_recaptcha_register").length&&(google_recaptcha_user_registration=grecaptcha.render("node_recaptcha_register",{sitekey:ur_google_recaptcha_code.site_key,theme:"light",style:"transform:scale(0.77);-webkit-transform:scale(0.77);transform-origin:0 0;-webkit-transform-origin:0 0;"}));0!==jQuery(".ur-frontend-form").find("form.login .ur-form-row .ur-form-grid #ur-recaptcha-node #node_recaptcha_login").length&&grecaptcha.render("node_recaptcha_login",{sitekey:ur_google_recaptcha_code.site_key,theme:"light",style:"transform:scale(0.77);-webkit-transform:scale(0.77);transform-origin:0 0;-webkit-transform-origin:0 0;"})};
|
includes/admin/settings/class-ur-settings-general.php
CHANGED
@@ -41,7 +41,8 @@ if ( ! class_exists( 'UR_Settings_General' ) ) :
|
|
41 |
*/
|
42 |
public function get_sections() {
|
43 |
$sections = array(
|
44 |
-
''
|
|
|
45 |
'frontend-messages' => __( 'Frontend Messages', 'user-registration' ),
|
46 |
);
|
47 |
|
@@ -89,23 +90,6 @@ if ( ! class_exists( 'UR_Settings_General' ) ) :
|
|
89 |
'desc_tip' => true,
|
90 |
'css' => 'min-width: 350px;',
|
91 |
),
|
92 |
-
array(
|
93 |
-
'title' => __( 'Registration URL', 'user-registration' ),
|
94 |
-
'desc' => __( 'This option lets you enter the registration page url in login form.', 'user-registration' ),
|
95 |
-
'id' => 'user_registration_general_setting_registration_url_options',
|
96 |
-
'type' => 'text',
|
97 |
-
'desc_tip' => true,
|
98 |
-
'css' => 'min-width: 350px;',
|
99 |
-
),
|
100 |
-
array(
|
101 |
-
'title' => __( 'Registration URL label', 'user-registration' ),
|
102 |
-
'desc' => __( 'This option lets you enter the label to registration url in login form.', 'user-registration' ),
|
103 |
-
'id' => 'user_registration_general_setting_registration_label',
|
104 |
-
'type' => 'text',
|
105 |
-
'desc_tip' => true,
|
106 |
-
'css' => 'min-width: 350px;',
|
107 |
-
'default' => __( 'Not a member yet? Register now.','user-registration' )
|
108 |
-
),
|
109 |
array(
|
110 |
'title' => __( 'Prevent dashboard access', 'user-registration' ),
|
111 |
'desc' => __( 'This option lets you limit which roles you are willing to prevent dashboard access.', 'user-registration' ),
|
@@ -208,7 +192,7 @@ if ( ! class_exists( 'UR_Settings_General' ) ) :
|
|
208 |
public function get_frontend_messages_settings() {
|
209 |
|
210 |
$settings = apply_filters(
|
211 |
-
'
|
212 |
|
213 |
array(
|
214 |
'title' => __( 'Success Messages', 'user-registration' ),
|
@@ -326,8 +310,100 @@ if ( ! class_exists( 'UR_Settings_General' ) ) :
|
|
326 |
)
|
327 |
);
|
328 |
|
329 |
-
return apply_filters( '
|
330 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
331 |
/**
|
332 |
* Output the settings.
|
333 |
*/
|
@@ -337,9 +413,12 @@ if ( ! class_exists( 'UR_Settings_General' ) ) :
|
|
337 |
if( $current_section === '') {
|
338 |
$settings = $this->get_settings();
|
339 |
|
340 |
-
} elseif ( $current_section === 'frontend-messages') {
|
341 |
$settings = $this->get_frontend_messages_settings();
|
|
|
|
|
342 |
}
|
|
|
343 |
UR_Admin_Settings::output_fields( $settings );
|
344 |
}
|
345 |
|
@@ -354,10 +433,12 @@ if ( ! class_exists( 'UR_Settings_General' ) ) :
|
|
354 |
if( $current_section === '') {
|
355 |
$settings = $this->get_settings();
|
356 |
|
357 |
-
} elseif ( $current_section === 'frontend-messages') {
|
358 |
$settings = $this->get_frontend_messages_settings();
|
359 |
-
|
|
|
360 |
}
|
|
|
361 |
UR_Admin_Settings::save_fields( $settings );
|
362 |
}
|
363 |
|
41 |
*/
|
42 |
public function get_sections() {
|
43 |
$sections = array(
|
44 |
+
'' => __( 'General Options', 'user-registration' ),
|
45 |
+
'login-options' => __( 'Login Options', 'user-registration' ),
|
46 |
'frontend-messages' => __( 'Frontend Messages', 'user-registration' ),
|
47 |
);
|
48 |
|
90 |
'desc_tip' => true,
|
91 |
'css' => 'min-width: 350px;',
|
92 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
array(
|
94 |
'title' => __( 'Prevent dashboard access', 'user-registration' ),
|
95 |
'desc' => __( 'This option lets you limit which roles you are willing to prevent dashboard access.', 'user-registration' ),
|
192 |
public function get_frontend_messages_settings() {
|
193 |
|
194 |
$settings = apply_filters(
|
195 |
+
'user_registration_login_options_settings', array(
|
196 |
|
197 |
array(
|
198 |
'title' => __( 'Success Messages', 'user-registration' ),
|
310 |
)
|
311 |
);
|
312 |
|
313 |
+
return apply_filters( 'user_registration_get_frontend_messages_settings_'. $this->id, $settings );
|
314 |
}
|
315 |
+
|
316 |
+
/**
|
317 |
+
* Get settings for login form
|
318 |
+
* @return array
|
319 |
+
*/
|
320 |
+
public function get_login_options_settings() {
|
321 |
+
$settings = apply_filters(
|
322 |
+
'user_registration_login_options_settings', array(
|
323 |
+
|
324 |
+
array(
|
325 |
+
'title' => __( 'Login Options', 'user-registration' ),
|
326 |
+
'type' => 'title',
|
327 |
+
'desc' => '',
|
328 |
+
'id' => 'login_options_settings',
|
329 |
+
),
|
330 |
+
|
331 |
+
array(
|
332 |
+
'title' => __( 'Form Template', 'user-registration' ),
|
333 |
+
'desc' => __( 'Choose the login form template.', 'user-registration' ),
|
334 |
+
'id' => 'user_registration_login_options_form_template',
|
335 |
+
'type' => 'select',
|
336 |
+
'desc_tip' => true,
|
337 |
+
'css' => 'min-width: 350px;',
|
338 |
+
'default' => 'default',
|
339 |
+
'options' => array(
|
340 |
+
'default' => __( 'Default', 'user-registration' ),
|
341 |
+
'bordered' => __( 'Bordered', 'user-registration' ),
|
342 |
+
'flat' => __( 'Flat', 'user-registration' ),
|
343 |
+
'rounded' => __( 'Rounded', 'user-registration' ),
|
344 |
+
'rounded_edge' => __( 'Rounded Edge', 'user-registration' ),
|
345 |
+
),
|
346 |
+
),
|
347 |
+
|
348 |
+
array(
|
349 |
+
'title' => __( 'Enable remember me', 'user-registration' ),
|
350 |
+
'desc' => __( 'Check to enable/disable remember me.', 'user-registration' ),
|
351 |
+
'id' => 'user_registration_login_options_remember_me',
|
352 |
+
'type' => 'checkbox',
|
353 |
+
'desc_tip' => true,
|
354 |
+
'css' => 'min-width: 350px;',
|
355 |
+
'default' => 'yes',
|
356 |
+
),
|
357 |
+
|
358 |
+
array(
|
359 |
+
'title' => __( 'Enable lost password', 'user-registration' ),
|
360 |
+
'desc' => __( 'Check to enable/disable lost password.', 'user-registration' ),
|
361 |
+
'id' => 'user_registration_login_options_lost_password',
|
362 |
+
'type' => 'checkbox',
|
363 |
+
'desc_tip' => true,
|
364 |
+
'css' => 'min-width: 350px;',
|
365 |
+
'default' => 'yes',
|
366 |
+
),
|
367 |
+
|
368 |
+
array(
|
369 |
+
'title' => __( 'Enable google reCaptcha', 'user-registration' ),
|
370 |
+
'desc' => sprintf( __( 'Enable %1$s %2$s reCaptcha %3$s support', 'user-registration' ), '<a title="', 'Please make sure the site key and secret are not empty in setting page." href="' . admin_url() . 'admin.php?page=user-registration-settings&tab=integration" target="_blank">', '</a>' ),
|
371 |
+
'id' => 'user_registration_login_options_enable_recaptcha',
|
372 |
+
'type' => 'checkbox',
|
373 |
+
'desc_tip' => true,
|
374 |
+
'css' => 'min-width: 350px;',
|
375 |
+
'default' => 'yes',
|
376 |
+
),
|
377 |
+
|
378 |
+
array(
|
379 |
+
'title' => __( 'Registration URL', 'user-registration' ),
|
380 |
+
'desc' => __( 'This option lets you enter the registration page url in login form.', 'user-registration' ),
|
381 |
+
'id' => 'user_registration_general_setting_registration_url_options',
|
382 |
+
'type' => 'text',
|
383 |
+
'desc_tip' => true,
|
384 |
+
'css' => 'min-width: 350px;',
|
385 |
+
),
|
386 |
+
|
387 |
+
array(
|
388 |
+
'title' => __( 'Registration URL label', 'user-registration' ),
|
389 |
+
'desc' => __( 'This option lets you enter the label to registration url in login form.', 'user-registration' ),
|
390 |
+
'id' => 'user_registration_general_setting_registration_label',
|
391 |
+
'type' => 'text',
|
392 |
+
'desc_tip' => true,
|
393 |
+
'css' => 'min-width: 350px;',
|
394 |
+
'default' => __( 'Not a member yet? Register now.','user-registration' )
|
395 |
+
),
|
396 |
+
|
397 |
+
array(
|
398 |
+
'type' => 'sectionend',
|
399 |
+
'id' => 'login_options_settings',
|
400 |
+
),
|
401 |
+
)
|
402 |
+
);
|
403 |
+
|
404 |
+
return apply_filters( 'user_registration_get_login_options_settings_'. $this->id, $settings );
|
405 |
+
}
|
406 |
+
|
407 |
/**
|
408 |
* Output the settings.
|
409 |
*/
|
413 |
if( $current_section === '') {
|
414 |
$settings = $this->get_settings();
|
415 |
|
416 |
+
} elseif ( $current_section === 'frontend-messages' ) {
|
417 |
$settings = $this->get_frontend_messages_settings();
|
418 |
+
} elseif( $current_section === 'login-options' ) {
|
419 |
+
$settings = $this->get_login_options_settings();
|
420 |
}
|
421 |
+
|
422 |
UR_Admin_Settings::output_fields( $settings );
|
423 |
}
|
424 |
|
433 |
if( $current_section === '') {
|
434 |
$settings = $this->get_settings();
|
435 |
|
436 |
+
} elseif ( $current_section === 'frontend-messages' ) {
|
437 |
$settings = $this->get_frontend_messages_settings();
|
438 |
+
} elseif( $current_section === 'login-options' ) {
|
439 |
+
$settings = $this->get_login_options_settings();
|
440 |
}
|
441 |
+
|
442 |
UR_Admin_Settings::save_fields( $settings );
|
443 |
}
|
444 |
|
includes/class-ur-emailer.php
CHANGED
@@ -127,6 +127,8 @@ class UR_Emailer {
|
|
127 |
$name_value[ $form_data->field_name ] = isset( $form_data->value ) ? $form_data->value : '';
|
128 |
}
|
129 |
|
|
|
|
|
130 |
$email_object = isset( $valid_form_data['user_email'] ) ? $valid_form_data['user_email'] : array();
|
131 |
$user_login_object = isset( $valid_form_data['user_login'] ) ? $valid_form_data['user_login'] : array();
|
132 |
$email = isset( $email_object->value ) && ! empty( $email_object->value ) ? $email_object->value : '';
|
127 |
$name_value[ $form_data->field_name ] = isset( $form_data->value ) ? $form_data->value : '';
|
128 |
}
|
129 |
|
130 |
+
$name_value = apply_filters( 'user_registration_process_smart_tag', $name_value, $form_data, $form_id, $user_id );
|
131 |
+
|
132 |
$email_object = isset( $valid_form_data['user_email'] ) ? $valid_form_data['user_email'] : array();
|
133 |
$user_login_object = isset( $valid_form_data['user_login'] ) ? $valid_form_data['user_login'] : array();
|
134 |
$email = isset( $email_object->value ) && ! empty( $email_object->value ) ? $email_object->value : '';
|
includes/class-ur-form-handler.php
CHANGED
@@ -248,6 +248,9 @@ class UR_Form_Handler {
|
|
248 |
|
249 |
$nonce_value = isset( $_POST['_wpnonce'] ) ? $_POST['_wpnonce'] : '';
|
250 |
$nonce_value = isset( $_POST['user-registration-login-nonce'] ) ? $_POST['user-registration-login-nonce'] : $nonce_value;
|
|
|
|
|
|
|
251 |
|
252 |
if ( ! empty( $_POST['login'] ) && wp_verify_nonce( $nonce_value, 'user-registration-login' ) ) {
|
253 |
|
@@ -261,6 +264,10 @@ class UR_Form_Handler {
|
|
261 |
$validation_error = new WP_Error();
|
262 |
$validation_error = apply_filters( 'user_registration_process_login_errors', $validation_error, $_POST['username'], $_POST['password'] );
|
263 |
|
|
|
|
|
|
|
|
|
264 |
if ( $validation_error->get_error_code() ) {
|
265 |
throw new Exception( '<strong>' . __( 'ERROR:', 'user-registration' ) . '</strong> ' . $validation_error->get_error_message() );
|
266 |
}
|
248 |
|
249 |
$nonce_value = isset( $_POST['_wpnonce'] ) ? $_POST['_wpnonce'] : '';
|
250 |
$nonce_value = isset( $_POST['user-registration-login-nonce'] ) ? $_POST['user-registration-login-nonce'] : $nonce_value;
|
251 |
+
$recaptcha_value = isset( $_POST['g-recaptcha-response'] ) ? $_POST['g-recaptcha-response'] : '';
|
252 |
+
|
253 |
+
$recaptcha_enabled = get_option( 'user_registration_login_options_enable_recaptcha', 'no' );
|
254 |
|
255 |
if ( ! empty( $_POST['login'] ) && wp_verify_nonce( $nonce_value, 'user-registration-login' ) ) {
|
256 |
|
264 |
$validation_error = new WP_Error();
|
265 |
$validation_error = apply_filters( 'user_registration_process_login_errors', $validation_error, $_POST['username'], $_POST['password'] );
|
266 |
|
267 |
+
if( 'yes' === $recaptcha_enabled && '' == $recaptcha_value ) {
|
268 |
+
throw new Exception( '<strong>' . __( 'ERROR:', 'user-registration' ) . '</strong> ' . get_option( 'user_registration_form_submission_error_message_recaptcha', __( 'Captcha code error, please try again.' ), 'user-registration' ) );
|
269 |
+
}
|
270 |
+
|
271 |
if ( $validation_error->get_error_code() ) {
|
272 |
throw new Exception( '<strong>' . __( 'ERROR:', 'user-registration' ) . '</strong> ' . $validation_error->get_error_message() );
|
273 |
}
|
includes/class-ur-shortcodes.php
CHANGED
@@ -167,22 +167,8 @@ class UR_Shortcodes {
|
|
167 |
wp_localize_script( 'ur-password-strength-meter', 'enable_strong_password', $enable_strong_password );
|
168 |
}
|
169 |
|
170 |
-
$
|
171 |
-
$
|
172 |
-
$recaptcha_site_secret = get_option( 'user_registration_integration_setting_recaptcha_site_secret' );
|
173 |
-
|
174 |
-
if ( 'yes' == $recaptcha_enable && ! empty( $recaptcha_site_key ) && ! empty( $recaptcha_site_secret ) ) {
|
175 |
-
wp_enqueue_script( 'ur-google-recaptcha' );
|
176 |
-
wp_localize_script( 'ur-google-recaptcha', 'ur_google_recaptcha_code', array(
|
177 |
-
'site_key' => $recaptcha_site_key,
|
178 |
-
'site_secret' => $recaptcha_site_secret,
|
179 |
-
'is_captcha_enable' => true,
|
180 |
-
) );
|
181 |
-
|
182 |
-
$recaptcha_node = '<div id="node_recaptcha" class="g-recaptcha" style="margin-left:11px;transform:scale(0.77);-webkit-transform:scale(0.77);transform-origin:0 0;-webkit-transform-origin:0 0;"></div>';
|
183 |
-
} else {
|
184 |
-
$recaptcha_node = '';
|
185 |
-
}
|
186 |
|
187 |
include_once( UR_ABSPATH . 'includes/frontend/class-ur-frontend.php' );
|
188 |
ur_get_template( 'form-registration.php', array(
|
167 |
wp_localize_script( 'ur-password-strength-meter', 'enable_strong_password', $enable_strong_password );
|
168 |
}
|
169 |
|
170 |
+
$recaptcha_enabled = ur_get_form_setting_by_key( $form_id, 'user_registration_form_setting_enable_recaptcha_support' );
|
171 |
+
$recaptcha_node = ur_get_recaptcha_node( $recaptcha_enabled, 'register' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
|
173 |
include_once( UR_ABSPATH . 'includes/frontend/class-ur-frontend.php' );
|
174 |
ur_get_template( 'form-registration.php', array(
|
includes/functions-ur-core.php
CHANGED
@@ -1041,6 +1041,7 @@ function ur_get_all_user_registration_form() {
|
|
1041 |
* Checks user login option, if not email confirmation force not disable emails.
|
1042 |
*/
|
1043 |
function ur_get_user_login_option() {
|
|
|
1044 |
if( 'email_confirmation' !== get_option( 'user_registration_general_setting_login_options' ) ) {
|
1045 |
return array(
|
1046 |
'title' => __( 'Disable emails', 'user-registration' ),
|
@@ -1056,6 +1057,44 @@ function ur_get_user_login_option() {
|
|
1056 |
}
|
1057 |
}
|
1058 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1059 |
/**
|
1060 |
* Get link for back button used on email settings.
|
1061 |
* @param string $label
|
1041 |
* Checks user login option, if not email confirmation force not disable emails.
|
1042 |
*/
|
1043 |
function ur_get_user_login_option() {
|
1044 |
+
|
1045 |
if( 'email_confirmation' !== get_option( 'user_registration_general_setting_login_options' ) ) {
|
1046 |
return array(
|
1047 |
'title' => __( 'Disable emails', 'user-registration' ),
|
1057 |
}
|
1058 |
}
|
1059 |
|
1060 |
+
/**
|
1061 |
+
* Get the node to display google reCaptcha
|
1062 |
+
* @return string
|
1063 |
+
*/
|
1064 |
+
function ur_get_recaptcha_node( $recaptcha_enabled = 'no', $context ) {
|
1065 |
+
|
1066 |
+
$recaptcha_site_key = get_option( 'user_registration_integration_setting_recaptcha_site_key' );
|
1067 |
+
$recaptcha_site_secret = get_option( 'user_registration_integration_setting_recaptcha_site_secret' );
|
1068 |
+
|
1069 |
+
static $rc_counter = 0;
|
1070 |
+
|
1071 |
+
if ( 'yes' == $recaptcha_enabled && ! empty( $recaptcha_site_key ) && ! empty( $recaptcha_site_secret ) ) {
|
1072 |
+
|
1073 |
+
if( 0 === $rc_counter ) {
|
1074 |
+
wp_enqueue_script( 'ur-google-recaptcha' );
|
1075 |
+
wp_localize_script( 'ur-google-recaptcha', 'ur_google_recaptcha_code', array(
|
1076 |
+
'site_key' => $recaptcha_site_key,
|
1077 |
+
'site_secret' => $recaptcha_site_secret,
|
1078 |
+
'is_captcha_enable' => true,
|
1079 |
+
) );
|
1080 |
+
|
1081 |
+
$rc_counter++;
|
1082 |
+
}
|
1083 |
+
|
1084 |
+
if( $context === 'login' ) {
|
1085 |
+
$recaptcha_node = '<div id="node_recaptcha_login" class="g-recaptcha" style="margin-left:11px;transform:scale(0.77);-webkit-transform:scale(0.77);transform-origin:0 0;-webkit-transform-origin:0 0;"></div>';
|
1086 |
+
} elseif ($context === 'register' ) {
|
1087 |
+
$recaptcha_node = '<div id="node_recaptcha_register" class="g-recaptcha" style="margin-left:11px;transform:scale(0.77);-webkit-transform:scale(0.77);transform-origin:0 0;-webkit-transform-origin:0 0;"></div>';
|
1088 |
+
} else {
|
1089 |
+
$recaptcha_node = '';
|
1090 |
+
}
|
1091 |
+
} else {
|
1092 |
+
$recaptcha_node = '';
|
1093 |
+
}
|
1094 |
+
|
1095 |
+
return $recaptcha_node;
|
1096 |
+
}
|
1097 |
+
|
1098 |
/**
|
1099 |
* Get link for back button used on email settings.
|
1100 |
* @param string $label
|
includes/functions-ur-template.php
CHANGED
@@ -504,6 +504,7 @@ if ( ! function_exists( 'user_registration_account_edit_account' ) ) {
|
|
504 |
function ur_logout_url( $redirect = '' ) {
|
505 |
$logout_endpoint = get_option( 'user_registration_logout_endpoint' );
|
506 |
$redirect = $redirect ? $redirect : ur_get_page_permalink( 'myaccount' );
|
|
|
507 |
|
508 |
if ( $logout_endpoint ) {
|
509 |
return wp_nonce_url( ur_get_endpoint_url( 'user-logout', '', $redirect ), 'user-logout' );
|
504 |
function ur_logout_url( $redirect = '' ) {
|
505 |
$logout_endpoint = get_option( 'user_registration_logout_endpoint' );
|
506 |
$redirect = $redirect ? $redirect : ur_get_page_permalink( 'myaccount' );
|
507 |
+
$redirect = apply_filters( 'user_registration_redirect_after_logout', $redirect );
|
508 |
|
509 |
if ( $logout_endpoint ) {
|
510 |
return wp_nonce_url( ur_get_endpoint_url( 'user-logout', '', $redirect ), 'user-logout' );
|
includes/shortcodes/class-ur-shortcode-login.php
CHANGED
@@ -38,14 +38,20 @@ class UR_Shortcode_Login {
|
|
38 |
public static function output( $atts ) {
|
39 |
global $wp, $post;
|
40 |
|
41 |
-
$redirect_url
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
if ( ! is_user_logged_in() ) {
|
|
|
44 |
|
45 |
if ( isset( $wp->query_vars['lost-password'] ) ) {
|
46 |
UR_Shortcode_My_Account::lost_password();
|
47 |
} else {
|
48 |
-
ur_get_template( 'myaccount/form-login.php' );
|
49 |
}
|
50 |
}
|
51 |
else
|
38 |
public static function output( $atts ) {
|
39 |
global $wp, $post;
|
40 |
|
41 |
+
$redirect_url = isset( $atts['redirect_url']) ? $atts['redirect_url'] : '';
|
42 |
+
$recaptcha_enabled = get_option( 'user_registration_login_options_enable_recaptcha', 'no' );
|
43 |
+
|
44 |
+
if( 'yes' === $recaptcha_enabled ) {
|
45 |
+
wp_enqueue_script( 'user-registration' );
|
46 |
+
}
|
47 |
|
48 |
if ( ! is_user_logged_in() ) {
|
49 |
+
$recaptcha_node = ur_get_recaptcha_node( $recaptcha_enabled, 'login' );
|
50 |
|
51 |
if ( isset( $wp->query_vars['lost-password'] ) ) {
|
52 |
UR_Shortcode_My_Account::lost_password();
|
53 |
} else {
|
54 |
+
ur_get_template( 'myaccount/form-login.php', array( 'recaptcha_node' => $recaptcha_node ) );
|
55 |
}
|
56 |
}
|
57 |
else
|
includes/shortcodes/class-ur-shortcode-my-account.php
CHANGED
@@ -43,7 +43,12 @@ class UR_Shortcode_My_Account {
|
|
43 |
wp_enqueue_style( 'flatpickr' );
|
44 |
wp_enqueue_script( 'user-registration' );
|
45 |
|
|
|
46 |
if ( ! is_user_logged_in() ) {
|
|
|
|
|
|
|
|
|
47 |
$message = apply_filters( 'user_registration_my_account_message', '' );
|
48 |
|
49 |
if ( ! empty( $message ) ) {
|
@@ -58,7 +63,7 @@ class UR_Shortcode_My_Account {
|
|
58 |
if ( isset( $wp->query_vars['lost-password'] ) ) {
|
59 |
self::lost_password();
|
60 |
} else {
|
61 |
-
ur_get_template( 'myaccount/form-login.php' );
|
62 |
}
|
63 |
} else {
|
64 |
// Start output buffer since the html may need discarding for BW compatibility
|
43 |
wp_enqueue_style( 'flatpickr' );
|
44 |
wp_enqueue_script( 'user-registration' );
|
45 |
|
46 |
+
|
47 |
if ( ! is_user_logged_in() ) {
|
48 |
+
|
49 |
+
$recaptcha_enabled = get_option( 'user_registration_login_options_enable_recaptcha', 'no' );
|
50 |
+
$recaptcha_node = ur_get_recaptcha_node( $recaptcha_enabled, 'login' );
|
51 |
+
|
52 |
$message = apply_filters( 'user_registration_my_account_message', '' );
|
53 |
|
54 |
if ( ! empty( $message ) ) {
|
63 |
if ( isset( $wp->query_vars['lost-password'] ) ) {
|
64 |
self::lost_password();
|
65 |
} else {
|
66 |
+
ur_get_template( 'myaccount/form-login.php', array( 'recaptcha_node' => $recaptcha_node ) );
|
67 |
}
|
68 |
} else {
|
69 |
// Start output buffer since the html may need discarding for BW compatibility
|
package-lock.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
{
|
2 |
"name": "user-registration",
|
3 |
-
"version": "1.4.
|
4 |
"lockfileVersion": 1,
|
5 |
"requires": true,
|
6 |
"dependencies": {
|
1 |
{
|
2 |
"name": "user-registration",
|
3 |
+
"version": "1.4.7",
|
4 |
"lockfileVersion": 1,
|
5 |
"requires": true,
|
6 |
"dependencies": {
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: user registration, registration, user profile, registration form, login fo
|
|
4 |
Requires at least: 4.0
|
5 |
Requires PHP: 5.4
|
6 |
Tested up to: 4.9
|
7 |
-
Stable tag: 1.4.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -104,6 +104,14 @@ Yes, the plugin is designed to work with any themes that have been coded followi
|
|
104 |
|
105 |
== Changelog ==
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
= 1.4.6 - 31/08/2018 =
|
108 |
* Fix - Remove filter to avoid plugin conflict while sending emails
|
109 |
* Fix - Load assests correctly
|
4 |
Requires at least: 4.0
|
5 |
Requires PHP: 5.4
|
6 |
Tested up to: 4.9
|
7 |
+
Stable tag: 1.4.7
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
104 |
|
105 |
== Changelog ==
|
106 |
|
107 |
+
= 1.4.7 - 20/09/2018 =
|
108 |
+
* Feature - Google reCaptcha on login form
|
109 |
+
* Feature - Templates for login form
|
110 |
+
* Feature - Enable/Disable remember me and lost password
|
111 |
+
* Add - Filter to process smart tags
|
112 |
+
* Tweak - Move login related settings from general to login options
|
113 |
+
|
114 |
+
|
115 |
= 1.4.6 - 31/08/2018 =
|
116 |
* Fix - Remove filter to avoid plugin conflict while sending emails
|
117 |
* Fix - Load assests correctly
|
templates/myaccount/form-login.php
CHANGED
@@ -13,20 +13,36 @@
|
|
13 |
* @see https://docs.wpeverest.com/user-registration/template-structure/
|
14 |
* @author WPEverest
|
15 |
* @package UserRegistration/Templates
|
16 |
-
* @version 1.
|
17 |
*/
|
18 |
|
19 |
if ( ! defined( 'ABSPATH' ) ) {
|
20 |
exit; // Exit if accessed directly
|
21 |
}
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
?>
|
24 |
|
25 |
<?php apply_filters( 'user_registration_login_form_before_notice', ur_print_notices() ); ?>
|
26 |
|
27 |
<?php do_action( 'user_registration_before_customer_login_form' ); ?>
|
28 |
|
29 |
-
<div class="ur-frontend-form login" id="ur-frontend-form">
|
30 |
|
31 |
<form class="user-registration-form user-registration-form-login login" method="post">
|
32 |
|
@@ -43,23 +59,48 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
43 |
<input class="user-registration-Input user-registration-Input--text input-text" type="password" name="password" id="password" />
|
44 |
</p>
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
<?php do_action( 'user_registration_login_form' ); ?>
|
47 |
|
48 |
<p class="form-row">
|
49 |
<?php wp_nonce_field( 'user-registration-login', 'user-registration-login-nonce' ); ?>
|
50 |
<input type="submit" class="user-registration-Button button" name="login" value="<?php esc_attr_e( 'Login', 'user-registration' ); ?>" />
|
51 |
<input type="hidden" name="redirect" value="<?php the_permalink() ?>" />
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
</p>
|
59 |
|
60 |
-
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
-
|
63 |
echo '<p class="user-registration-register register">';
|
64 |
$label = get_option('user_registration_general_setting_registration_label');
|
65 |
|
13 |
* @see https://docs.wpeverest.com/user-registration/template-structure/
|
14 |
* @author WPEverest
|
15 |
* @package UserRegistration/Templates
|
16 |
+
* @version 1.4.7
|
17 |
*/
|
18 |
|
19 |
if ( ! defined( 'ABSPATH' ) ) {
|
20 |
exit; // Exit if accessed directly
|
21 |
}
|
22 |
|
23 |
+
$form_template = get_option( 'user_registration_login_options_form_template', 'default' );
|
24 |
+
$template_class = '';
|
25 |
+
|
26 |
+
if ( 'bordered' === $form_template ) {
|
27 |
+
$template_class = 'ur-frontend-form--bordered';
|
28 |
+
|
29 |
+
} elseif ( 'flat' === $form_template ) {
|
30 |
+
$template_class = 'ur-frontend-form--flat';
|
31 |
+
|
32 |
+
} elseif( 'rounded' === $form_template ) {
|
33 |
+
$template_class = 'ur-frontend-form--rounded';
|
34 |
+
|
35 |
+
} elseif( 'rounded_edge' === $form_template ) {
|
36 |
+
$template_class = 'ur-frontend-form--rounded ur-frontend-form--rounded-edge';
|
37 |
+
}
|
38 |
+
|
39 |
?>
|
40 |
|
41 |
<?php apply_filters( 'user_registration_login_form_before_notice', ur_print_notices() ); ?>
|
42 |
|
43 |
<?php do_action( 'user_registration_before_customer_login_form' ); ?>
|
44 |
|
45 |
+
<div class="ur-frontend-form login <?php echo $template_class; ?>" id="ur-frontend-form">
|
46 |
|
47 |
<form class="user-registration-form user-registration-form-login login" method="post">
|
48 |
|
59 |
<input class="user-registration-Input user-registration-Input--text input-text" type="password" name="password" id="password" />
|
60 |
</p>
|
61 |
|
62 |
+
<?php
|
63 |
+
if( ! empty( $recaptcha_node ) ) {
|
64 |
+
echo '<div id="ur-recaptcha-node" style="width:100px;max-width: 100px;"> '. $recaptcha_node .'</div>';
|
65 |
+
}
|
66 |
+
?>
|
67 |
+
|
68 |
<?php do_action( 'user_registration_login_form' ); ?>
|
69 |
|
70 |
<p class="form-row">
|
71 |
<?php wp_nonce_field( 'user-registration-login', 'user-registration-login-nonce' ); ?>
|
72 |
<input type="submit" class="user-registration-Button button" name="login" value="<?php esc_attr_e( 'Login', 'user-registration' ); ?>" />
|
73 |
<input type="hidden" name="redirect" value="<?php the_permalink() ?>" />
|
74 |
+
|
75 |
+
<?php
|
76 |
+
$remember_me_enabled = get_option( 'user_registration_login_options_remember_me', 'yes' );
|
77 |
+
|
78 |
+
if( 'yes' === $remember_me_enabled ) {
|
79 |
+
?>
|
80 |
+
<label class="user-registration-form__label user-registration-form__label-for-checkbox inline">
|
81 |
+
<input class="user-registration-form__input user-registration-form__input-checkbox" name="rememberme" type="checkbox" id="rememberme" value="forever" /> <span><?php _e( 'Remember me', 'user-registration' ); ?></span>
|
82 |
+
</label>
|
83 |
+
<?php
|
84 |
+
}
|
85 |
+
?>
|
86 |
</p>
|
87 |
|
88 |
+
<?php
|
89 |
+
$lost_password_enabled = get_option( 'user_registration_login_options_lost_password', 'yes' );
|
90 |
+
|
91 |
+
if( 'yes' === $lost_password_enabled ) {
|
92 |
+
?>
|
93 |
+
<p class="user-registration-LostPassword lost_password">
|
94 |
+
<a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?', 'user-registration' ); ?></a>
|
95 |
+
</p>
|
96 |
+
<?php
|
97 |
+
}
|
98 |
+
?>
|
99 |
+
|
100 |
+
<?php
|
101 |
+
$url_options = get_option( 'user_registration_general_setting_registration_url_options' );
|
102 |
|
103 |
+
if ( ! empty( $url_options ) ) {
|
104 |
echo '<p class="user-registration-register register">';
|
105 |
$label = get_option('user_registration_general_setting_registration_label');
|
106 |
|
user-registration.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: User Registration
|
4 |
* Plugin URI: https://wpeverest.com/plugins/user-registration
|
5 |
* Description: Drag and Drop user registration and login form builder.
|
6 |
-
* Version: 1.4.
|
7 |
* Author: WPEverest
|
8 |
* Author URI: https://wpeverest.com
|
9 |
* Text Domain: user-registration
|
@@ -30,7 +30,7 @@ final class UserRegistration {
|
|
30 |
* Plugin version.
|
31 |
* @var string
|
32 |
*/
|
33 |
-
public $version = '1.4.
|
34 |
|
35 |
/**
|
36 |
* Session instance.
|
3 |
* Plugin Name: User Registration
|
4 |
* Plugin URI: https://wpeverest.com/plugins/user-registration
|
5 |
* Description: Drag and Drop user registration and login form builder.
|
6 |
+
* Version: 1.4.7
|
7 |
* Author: WPEverest
|
8 |
* Author URI: https://wpeverest.com
|
9 |
* Text Domain: user-registration
|
30 |
* Plugin version.
|
31 |
* @var string
|
32 |
*/
|
33 |
+
public $version = '1.4.7';
|
34 |
|
35 |
/**
|
36 |
* Session instance.
|