Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions assets/js/users-wp.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,8 @@ function uwp_load_register_form(form_id, form, activeElement) {
url: uwp_localize_data.ajaxurl,
data: data,
beforeSend: function() {
jQuery(document).trigger('uwp_form_loading', { form_id, form });

if (activeElement) {
activeElement.addClass('active');
}
Expand All @@ -564,6 +566,8 @@ function uwp_load_register_form(form_id, form, activeElement) {
}

form.find('#uwp-form-select-ajax').attr('id', 'uwp-form-select');

jQuery(document).trigger('uwp_form_loaded', { form_id, form, html: data.data });
}

uwp_init_auth_modal();
Expand All @@ -575,20 +579,20 @@ function uwp_load_register_form(form_id, form, activeElement) {

function uwp_switch_reg_form_init() {
// Handle button clicks for lightbox (AJAX modal)
jQuery( '#uwp-form-select-ajax a' ).on( 'click', function( e ) {
jQuery( '#uwp-form-select-ajax a' ).off( 'click.uwpSwitchRegForm' ).on( 'click.uwpSwitchRegForm', function( e ) {
e.preventDefault(e);
var form_id = jQuery(this).attr('data-form_id');
uwp_modal_register_form(form_id);
});

// Handle select dropdown for lightbox (AJAX modal)
jQuery( '#uwp-form-select-ajax select#uwp-form-type-select' ).on( 'change', function( e ) {
jQuery( '#uwp-form-select-ajax select#uwp-form-type-select' ).off( 'change.uwpSwitchRegForm' ).on( 'change.uwpSwitchRegForm', function( e ) {
var form_id = jQuery(this).find('option:selected').attr('data-form_id');
uwp_modal_register_form(form_id);
});

// Handle button clicks for normal forms
jQuery( '#uwp-form-select a' ).on( 'click', function( e ) {
jQuery( '#uwp-form-select a' ).off( 'click.uwpSwitchRegForm' ).on( 'click.uwpSwitchRegForm', function( e ) {
e.preventDefault(e);
var self = jQuery(this);
var form_id = self.attr('data-form_id');
Expand All @@ -599,7 +603,7 @@ function uwp_switch_reg_form_init() {
});

// Handle select dropdown for normal forms
jQuery( '#uwp-form-select select#uwp-form-type-select' ).on( 'change', function( e ) {
jQuery( '#uwp-form-select select#uwp-form-type-select' ).off( 'change.uwpSwitchRegForm' ).on( 'change.uwpSwitchRegForm', function( e ) {
var self = jQuery(this);
var form_id = self.find('option:selected').attr('data-form_id');
var form = self.parents('form');
Expand Down
Loading