| @@ -327,10 +327,9 @@ | ||
| 327 | 327 | $profile_url = $obj->get_profile_link( get_author_posts_url( $user_id ), $user_id ); |
| 328 | 328 | wp_safe_redirect( $profile_url ); |
| 329 | 329 | exit(); |
| 330 | 330 | } else { |
| 331 | - $redirect_to = apply_filters( 'uwp_no_login_profile_redirect', uwp_get_page_link('login') ); | |
| 332 | - $redirect_to = add_query_arg('redirect_to', urlencode(get_permalink($profile_page)), $redirect_to); | |
| 331 | + $redirect_to = apply_filters( 'uwp_no_login_profile_redirect', home_url( '/' ) ); | |
| 333 | 332 | wp_safe_redirect( $redirect_to ); |
| 334 | 333 | exit(); |
| 335 | 334 | } |
| 336 | 335 | |
| @@ -525,47 +524,24 @@ | ||
| 525 | 524 | |
| 526 | 525 | $form_id = ! empty( $args['id'] ) ? (int) $args['id'] : uwp_get_option('register_modal_form', 1); |
| 527 | 526 | if ( $form_type == 'register' ) { |
| 528 | 527 | $fields = get_register_form_fields($form_id); |
| 529 | - // Use limit from args, otherwise fall back to the register_modal_form setting. | |
| 530 | - $form_limit = ! empty( $args['limit'] ) ? $args['limit'] : uwp_get_option('register_modal_form', ''); | |
| 528 | + $form_limit = ! empty( $args['limit'] ) ? $args['limit'] : ''; | |
| 531 | 529 | if(isset($form_limit) && !is_array($form_limit)){ |
| 532 | 530 | $form_limit = explode(',', $form_limit); |
| 533 | 531 | } |
| 534 | 532 | |
| 535 | - if(isset($form_limit) && !empty($form_limit) && count($form_limit) > 1){ | |
| 533 | + if(isset($form_limit) && !empty($form_limit) && count($form_limit) > 1){ | |
| 536 | 534 | |
| 537 | - $form_limit = array_map('uwp_clean', $form_limit); | |
| 538 | - $form_limit = array_map('trim', $form_limit); | |
| 539 | - $options = uwp_get_register_forms_dropdown_options($form_limit); | |
| 540 | - $selector_id = wp_doing_ajax() ? "uwp-form-select-ajax" : 'uwp-form-select'; | |
| 541 | - $display_style = uwp_get_option('register_form_display_style', 'buttons'); | |
| 535 | + $form_limit = array_map('uwp_clean', $form_limit); | |
| 536 | + $form_limit = array_map('trim', $form_limit); | |
| 537 | + $options = uwp_get_register_forms_dropdown_options($form_limit); | |
| 538 | + $id = wp_doing_ajax() ? "uwp-form-select-ajax" : 'uwp-form-select'; | |
| 542 | 539 | |
| 543 | - if ( $display_style === 'select' ) { | |
| 544 | - // Render as select dropdown. | |
| 545 | - $selector_label = apply_filters( 'uwp_account_type_selector_label', __('Account Type', 'userswp'), $form_type, $args ); | |
| 540 | + | |
| 546 | 541 | ?> |
| 547 | - <div class="form-group mb-3" id="<?php echo esc_attr( $selector_id ); ?>"> | |
| 548 | - <label for="uwp-form-type-select" class="form-label"><?php echo esc_html( $selector_label ); ?></label> | |
| 549 | - <select id="uwp-form-type-select" class="form-select aui-select2 w-100" data-form-selector="select"> | |
| 550 | - <?php | |
| 551 | - foreach ( $options as $option_id => $option_label ) { | |
| 552 | - $selected = $form_id == $option_id ? 'selected' : ''; | |
| 553 | - ?> | |
| 554 | - <option value="<?php echo esc_attr( $option_id ); ?>" <?php echo esc_attr( $selected ); ?> data-form_id="<?php echo esc_attr( $option_id ); ?>"> | |
| 555 | - <?php echo esc_html( $option_label ); ?> | |
| 556 | - </option> | |
| 557 | - <?php | |
| 558 | - } | |
| 559 | - ?> | |
| 560 | - </select> | |
| 561 | - </div> | |
| 542 | + <div class="btn-group btn-group-sm d-flex mb-2" role="group" id="<?php echo esc_attr( $id ); ?>"> | |
| 562 | 543 | <?php |
| 563 | - } else { | |
| 564 | - // Render as button groups (default) | |
| 565 | - ?> | |
| 566 | - <div class="btn-group btn-group-sm d-flex mb-3" role="group" id="<?php echo esc_attr( $selector_id ); ?>"> | |
| 567 | - <?php | |
| 568 | 544 | $options = array_chunk( $options, 5, true ); |
| 569 | 545 | $current_url = uwp_current_page_url(); |
| 570 | 546 | if ( isset( $options[0] ) && ! empty( $options[0] ) && count( $options[0] ) > 1 ) { |
| 571 | 547 | foreach ( $options[0] as $id => $val ) { |
| @@ -587,13 +563,13 @@ | ||
| 587 | 563 | foreach ( $options[1] as $id => $val ) { |
| 588 | 564 | $active = $form_id == $id ? 'active' : ''; |
| 589 | 565 | $url = esc_url_raw( add_query_arg( array( 'uwp_form_id' => $id ), $current_url ) ); |
| 590 | 566 | ?> |
| 591 | - <div class="btn-group" role="group"> | |
| 592 | - <button id="uwp-form-select-dropdown" type="button" class="btn btn-secondary dropdown-toggle" data-<?php echo ( $aui_bs5 ? 'bs-' : '' ); ?>toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | |
| 593 | - <?php esc_attr_e('More', 'userswp'); ?> | |
| 594 | - </button> | |
| 595 | - <div class="dropdown-menu mt-3" aria-labelledby="uwp-form-select"> | |
| 567 | + <div class="btn-group" role="group"> | |
| 568 | + <button id="uwp-form-select-dropdown" type="button" class="btn btn-secondary dropdown-toggle" data-<?php echo ( $aui_bs5 ? 'bs-' : '' ); ?>toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | |
| 569 | + <?php esc_attr_e('More', 'userswp'); ?> | |
| 570 | + </button> | |
| 571 | + <div class="dropdown-menu mt-3" aria-labelledby="uwp-form-select"> | |
| 596 | 572 | <?php |
| 597 | 573 | echo aui()->button( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 598 | 574 | 'type' => 'a', |
| 599 | 575 | 'href' => esc_url( $url ), |
| @@ -601,18 +577,17 @@ | ||
| 601 | 577 | 'content' => esc_attr( $val ), |
| 602 | 578 | 'extra_attributes' => array('data-form_id'=> esc_attr( $id ) ) |
| 603 | 579 | ) ); |
| 604 | 580 | ?> |
| 605 | - </div> | |
| 606 | - </div> | |
| 581 | + </div> | |
| 582 | + </div> | |
| 607 | 583 | <?php |
| 608 | 584 | } |
| 609 | 585 | } |
| 610 | 586 | ?> |
| 611 | - </div> | |
| 587 | + </div> | |
| 612 | 588 | <?php |
| 613 | 589 | } |
| 614 | - } | |
| 615 | 590 | } elseif ( $form_type == 'account' ) { |
| 616 | 591 | $fields = get_account_form_fields(); |
| 617 | 592 | } elseif ( $form_type == 'change' ) { |
| 618 | 593 | $fields = get_change_form_fields(); |
| @@ -675,13 +650,9 @@ | ||
| 675 | 650 | if ( $form_type == 'account' ) { |
| 676 | 651 | $user_data = get_userdata( $user_id ); |
| 677 | 652 | |
| 678 | 653 | if ( $field->htmlvar_name == 'email' ) { |
| 679 | - if(!empty($user_data)) { | |
| 680 | - $value = $user_data->user_email; | |
| 681 | - }else{ | |
| 682 | - $value = ''; | |
| 683 | - } | |
| 654 | + $value = $user_data->user_email; | |
| 684 | 655 | } elseif ( $field->htmlvar_name == 'password' ) { |
| 685 | 656 | $value = ''; |
| 686 | 657 | $field->is_required = 0; |
| 687 | 658 | } elseif ( $field->htmlvar_name == 'confirm_password' ) { |
| @@ -848,9 +819,9 @@ | ||
| 848 | 819 | |
| 849 | 820 | $hash = substr( hash( 'SHA256', AUTH_KEY . site_url() ), 0, 25 ); |
| 850 | 821 | echo '<input type="hidden" name="uwp_register_hash" value="' . esc_html( $hash ) . '" style="display:none !important; visibility:hidden !important;" />'; |
| 851 | 822 | echo '<input type="hidden" name="uwp_register_hp" value="" style="display:none !important; visibility:hidden !important;" size="25" autocomplete="off" />'; |
| 852 | - echo '<input type="hidden" name="uwp_register_nonce" value="' . esc_attr( wp_create_nonce( 'uwp-register-nonce-'. $form_id ) ) . '" />'; | |
| 823 | + echo '<input type="hidden" name="uwp_register_nonce" value="' . esc_attr( wp_create_nonce( 'uwp-register-nonce' ) ) . '" />'; | |
| 853 | 824 | echo '<input type="hidden" name="uwp_register_form_id" value="' . absint($form_id) . '">'; |
| 854 | 825 | } elseif ( $form_type == 'change' ) { |
| 855 | 826 | echo '<input type="hidden" name="uwp_change_nonce" value="' . esc_attr( wp_create_nonce( 'uwp-change-nonce' ) ) . '" />'; |
| 856 | 827 | } elseif ( $form_type == 'forgot' ) { |
| @@ -1055,12 +1026,8 @@ | ||
| 1055 | 1026 | } elseif ( is_uwp_page( 'users_page' ) ) { |
| 1056 | 1027 | $classes[] = 'uwp_users_page'; |
| 1057 | 1028 | } |
| 1058 | 1029 | } |
| 1059 | - | |
| 1060 | - if(is_user_logged_in()){ | |
| 1061 | - $classes[] = 'uwp-user-type-'.uwp_get_register_form_id( get_current_user_id() ); | |
| 1062 | - } | |
| 1063 | 1030 | |
| 1064 | 1031 | return $classes; |
| 1065 | 1032 | } |
| 1066 | 1033 | |