PluginProbe
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP / 1.2.11
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP v1.2.11
1.2.74 1.2.73 1.2.72 1.2.71 1.2.70 1.2.69 1.2.68 1.2.67 1.2.66 1.2.65 1.2.64 1.2.63 trunk 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.20 1.0.21 All 174 releases
← All changes | includes/class-templates.php +22 -81 1.2.651.2.11 View file →
@@ -55,8 +55,9 @@
55 55 *
56 56 * @return string
57 57 */
58 58 public static function setup_singular_page_content( $content ) {
59 +
59 60 global $post, $wp_query;
60 61
61 62 if ( ! is_uwp_page() ) {
62 63 return $content;
@@ -327,10 +328,9 @@
327 328 $profile_url = $obj->get_profile_link( get_author_posts_url( $user_id ), $user_id );
328 329 wp_safe_redirect( $profile_url );
329 330 exit();
330 331 } 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);
332 + $redirect_to = apply_filters( 'uwp_no_login_profile_redirect', home_url( '/' ) );
333 333 wp_safe_redirect( $redirect_to );
334 334 exit();
335 335 }
336 336
@@ -525,47 +525,24 @@
525 525
526 526 $form_id = ! empty( $args['id'] ) ? (int) $args['id'] : uwp_get_option('register_modal_form', 1);
527 527 if ( $form_type == 'register' ) {
528 528 $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', '');
529 + $form_limit = ! empty( $args['limit'] ) ? $args['limit'] : '';
531 530 if(isset($form_limit) && !is_array($form_limit)){
532 531 $form_limit = explode(',', $form_limit);
533 532 }
534 533
535 - if(isset($form_limit) && !empty($form_limit) && count($form_limit) > 1){
534 + if(isset($form_limit) && !empty($form_limit) && count($form_limit) > 1){
536 535
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');
536 + $form_limit = array_map('uwp_clean', $form_limit);
537 + $form_limit = array_map('trim', $form_limit);
538 + $options = uwp_get_register_forms_dropdown_options($form_limit);
539 + $id = wp_doing_ajax() ? "uwp-form-select-ajax" : 'uwp-form-select';
542 540
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 );
541 +
546 542 ?>
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>
543 + <div class="btn-group btn-group-sm mb-2" role="group" id="<?php echo esc_attr( $id ); ?>">
562 544 <?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 545 $options = array_chunk( $options, 5, true );
569 546 $current_url = uwp_current_page_url();
570 547 if ( isset( $options[0] ) && ! empty( $options[0] ) && count( $options[0] ) > 1 ) {
571 548 foreach ( $options[0] as $id => $val ) {
@@ -572,10 +549,10 @@
572 549 $active = $form_id == $id ? 'active' : '';
573 550 $url = esc_url_raw( add_query_arg( array( 'uwp_form_id' => $id ), $current_url ) );
574 551 echo aui()->button( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
575 552 'type' => 'a',
576 - 'href' => '#',
577 - 'class' => 'btn btn-outline-primary '. esc_attr( $active ),
553 + 'href' => esc_url( $url ),
554 + 'class' => 'btn btn-secondary '. esc_attr( $active ),
578 555 'content' => esc_attr( $val ),
579 556 'extra_attributes' => array('data-form_id'=> esc_attr( $id ) )
580 557 ) );
581 558 }
@@ -587,13 +564,13 @@
587 564 foreach ( $options[1] as $id => $val ) {
588 565 $active = $form_id == $id ? 'active' : '';
589 566 $url = esc_url_raw( add_query_arg( array( 'uwp_form_id' => $id ), $current_url ) );
590 567 ?>
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">
568 + <div class="btn-group" role="group">
569 + <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">
570 + <?php esc_attr_e('More', 'userswp'); ?>
571 + </button>
572 + <div class="dropdown-menu mt-3" aria-labelledby="uwp-form-select">
596 573 <?php
597 574 echo aui()->button( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
598 575 'type' => 'a',
599 576 'href' => esc_url( $url ),
@@ -601,18 +578,17 @@
601 578 'content' => esc_attr( $val ),
602 579 'extra_attributes' => array('data-form_id'=> esc_attr( $id ) )
603 580 ) );
604 581 ?>
605 - </div>
606 - </div>
582 + </div>
583 + </div>
607 584 <?php
608 585 }
609 586 }
610 587 ?>
611 - </div>
588 + </div>
612 589 <?php
613 590 }
614 - }
615 591 } elseif ( $form_type == 'account' ) {
616 592 $fields = get_account_form_fields();
617 593 } elseif ( $form_type == 'change' ) {
618 594 $fields = get_change_form_fields();
@@ -675,13 +651,9 @@
675 651 if ( $form_type == 'account' ) {
676 652 $user_data = get_userdata( $user_id );
677 653
678 654 if ( $field->htmlvar_name == 'email' ) {
679 - if(!empty($user_data)) {
680 - $value = $user_data->user_email;
681 - }else{
682 - $value = '';
683 - }
655 + $value = $user_data->user_email;
684 656 } elseif ( $field->htmlvar_name == 'password' ) {
685 657 $value = '';
686 658 $field->is_required = 0;
687 659 } elseif ( $field->htmlvar_name == 'confirm_password' ) {
@@ -809,10 +781,8 @@
809 781 }
810 782 }
811 783 }
812 784
813 - $redirect_to = apply_filters('uwp_login_redirect_to', $redirect_to, $args);
814 -
815 785 if ( $redirect_to ) {
816 786 echo '<input type="hidden" name="redirect_to" value="' . esc_url( $redirect_to ) . '"/>';
817 787 }
818 788
@@ -839,10 +809,8 @@
839 809 }
840 810 }
841 811 }
842 812
843 - $redirect_to = apply_filters('uwp_register_redirect_to', $redirect_to, $args);
844 -
845 813 if ( $redirect_to ) {
846 814 echo '<input type="hidden" name="redirect_to" value="' . esc_url( $redirect_to ) . '"/>';
847 815 }
848 816
@@ -848,9 +816,9 @@
848 816
849 817 $hash = substr( hash( 'SHA256', AUTH_KEY . site_url() ), 0, 25 );
850 818 echo '<input type="hidden" name="uwp_register_hash" value="' . esc_html( $hash ) . '" style="display:none !important; visibility:hidden !important;" />';
851 819 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 ) ) . '" />';
820 + echo '<input type="hidden" name="uwp_register_nonce" value="' . esc_attr( wp_create_nonce( 'uwp-register-nonce' ) ) . '" />';
853 821 echo '<input type="hidden" name="uwp_register_form_id" value="' . absint($form_id) . '">';
854 822 } elseif ( $form_type == 'change' ) {
855 823 echo '<input type="hidden" name="uwp_change_nonce" value="' . esc_attr( wp_create_nonce( 'uwp-change-nonce' ) ) . '" />';
856 824 } elseif ( $form_type == 'forgot' ) {
@@ -1056,12 +1024,8 @@
1056 1024 $classes[] = 'uwp_users_page';
1057 1025 }
1058 1026 }
1059 1027
1060 - if(is_user_logged_in()){
1061 - $classes[] = 'uwp-user-type-'.uwp_get_register_form_id( get_current_user_id() );
1062 - }
1063 -
1064 1028 return $classes;
1065 1029 }
1066 1030
1067 1031 /**
@@ -1367,29 +1331,6 @@
1367 1331
1368 1332 $theme_template_path = $theme_root . '/' . $template . '/' . untrailingslashit( uwp_get_theme_template_dir_name() );
1369 1333
1370 1334 return $theme_template_path;
1371 - }
1372 -
1373 - /**
1374 - * Check & unset the_content hook.
1375 - *
1376 - * @since 1.2.13
1377 - *
1378 - * @param string $content The content.
1379 - * @return string The post content.
1380 - */
1381 - public function set_the_content_hook( $content ) {
1382 - global $wp_query, $post, $uwp_set_wpautop;
1383 -
1384 - // Prevent empty p tags on block theme.
1385 - if ( function_exists( 'wp_is_block_theme' ) && wp_is_block_theme() && ! empty( $wp_query ) && ! empty( $post ) && $post->ID == get_queried_object_id() && is_uwp_page() ) {
1386 - if ( $has_filter = has_filter( 'the_content', 'wpautop' ) ) {
1387 - $uwp_set_wpautop = $has_filter;
1388 -
1389 - remove_filter( 'the_content', 'wpautop' );
1390 - }
1391 - }
1392 -
1393 - return $content;
1394 1335 }
1395 1336 }