Skip to content

Commit

Permalink
disable submit in preview
Browse files Browse the repository at this point in the history
  • Loading branch information
suvedisamyog committed Dec 27, 2024
1 parent 1146497 commit 9153024
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions includes/admin/class-ur-admin-form-preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static function add_menu() {
public static function welcome_page() {
wp_register_script( 'ur-form-preview-tooltipster', UR()->plugin_url() . '/assets/js/tooltipster/tooltipster.bundle.js', array( 'jquery' ), UR()->version, true );
wp_register_script( 'ur-form-preview-copy', UR()->plugin_url() . '/assets/js/admin/ur-copy.js', array( 'jquery' ), UR()->version, true );
wp_register_script( 'ur-form-preview-admin-script', UR()->plugin_url() . '/assets/js/admin/admin.js', array( 'wp-element', 'wp-blocks', 'wp-editor' ), UR()->version, true );
wp_register_script( 'ur-form-preview-admin-script', UR()->plugin_url() . '/assets/js/admin/admin.js', array( 'wp-element', 'wp-blocks', 'wp-editor' ), UR()->version );
wp_register_style( 'ur-form-preview-admin-style', UR()->plugin_url() . '/assets/css/admin.css', array(), UR()->version );
wp_register_style( 'ur-form-preview-default-style', UR()->plugin_url() . '/assets/css/user-registration.css', array(), UR()->version );
wp_register_style( 'ur-form-preview-smallscreens', UR()->plugin_url() . '/assets/css/user-registration-smallscreen.css', array(), UR()->version );
Expand All @@ -65,7 +65,7 @@ public static function welcome_page() {
array(
'ajax_url' => admin_url( 'admin-ajax.php' ),
'form_preview_nonce' => wp_create_nonce( 'ur_form_preview_nonce' ),
'pro_upgrade_link' => 'https://wpeverest.com/wordpress-plugins/user-registration/?utm_source=plugin&utm_medium=form-preview&utm_campaign=pro-upgrade',
'pro_upgrade_link' => esc_url('https://wpuserregistration.com/pricing/?utm_source=form-preview&utm_medium=sidebar-upgrade-button&utm_campaign=' . UR()->utm_campaign),
)
);

Expand All @@ -74,7 +74,7 @@ public static function welcome_page() {
ob_start();
self::form_preview_header();
self::form_preview_body();
self::setup_wizard_footer();
self::form_preview_footer();
exit;
}
}
Expand Down Expand Up @@ -187,7 +187,7 @@ public static function form_preview_body() {
*
* @since 1.0.0
*/
public static function setup_wizard_footer() {
public static function form_preview_footer() {
if ( function_exists( 'wp_print_media_templates' ) ) {
wp_print_media_templates();
}
Expand Down
4 changes: 3 additions & 1 deletion templates/form-registration.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,10 @@
$condition_submit_settings = ur_maybe_unserialize( get_post_meta( $form_id, 'user_registration_submit_condition', true ) );

$submit_btn_class = array_merge( $submit_btn_class, (array) ur_get_form_setting_by_key( $form_id, 'user_registration_form_setting_form_submit_class' ) );
$disabled = isset($_GET['page']) && 'ur_form_preview' === $_GET['page'] ? 'disabled' : '';
$css = $disabled ? 'cursor: not-allowed;' : '';
?>
<button type="submit" class="btn button ur-submit-button <?php echo esc_attr( implode( ' ', $submit_btn_class ) ); ?>" conditional_rules="<?php echo ur_string_to_bool( ur_get_single_post_meta( $form_id, 'user_registration_form_setting_enable_submit_conditional_logic', true ) ) ? esc_attr( wp_json_encode( $condition_submit_settings ) ) : ''; ?>">
<button type="submit" <?php echo esc_attr($disabled) ?> class="btn button ur-submit-button <?php echo esc_attr( implode( ' ', $submit_btn_class ) ); ?>" style="<?php echo $css ?>" conditional_rules="<?php echo ur_string_to_bool( ur_get_single_post_meta( $form_id, 'user_registration_form_setting_enable_submit_conditional_logic', true ) ) ? esc_attr( wp_json_encode( $condition_submit_settings ) ) : ''; ?>">
<span></span>
<?php
$submit = ur_get_form_setting_by_key( $form_id, 'user_registration_form_setting_form_submit_label' );
Expand Down

0 comments on commit 9153024

Please sign in to comment.