| @@ -1,72 +1,36 @@ | ||
| 1 | 1 | <?php do_action('uwp_template_before', 'dashboard'); |
| 2 | 2 | $user_id = get_current_user_id(); |
| 3 | 3 | $user_info = get_userdata($user_id); |
| 4 | -$display_name = $user_info->data->display_name; | |
| 4 | +$display_name = esc_attr( $user_info->data->display_name ); | |
| 5 | 5 | $profile_link = uwp_build_profile_tab_url($user_id); |
| 6 | -$hello_text = !empty($uwp_login_widget_args['dashboard_text']) ? esc_attr__($uwp_login_widget_args['dashboard_text'],'userswp') : __( 'Hello, %s', 'userswp' ); | |
| 7 | -$display_name = "<a href='$profile_link' >".esc_attr($display_name)."</a>"; | |
| 6 | +$hello_text = !empty($args['dashboard_text']) ? esc_attr__($args['dashboard_text'],'userswp') : __( 'Hello, %s', 'userswp' ); | |
| 7 | +$display_name = "<a href='".esc_url($profile_link)."' >".esc_attr($display_name)."</a>"; | |
| 8 | 8 | $hello_text = sprintf($hello_text,$display_name); |
| 9 | +$dashboard_links = !empty($args['template_args']['dashboard_links']) ? $args['template_args']['dashboard_links'] : ''; | |
| 9 | 10 | ?> |
| 10 | 11 | <div class="uwp-content-wrap"> |
| 11 | - <div class="uwp-account" <?php if(!empty($uwp_login_widget_args['form_padding'])){echo "style='padding:".absint($uwp_login_widget_args['form_padding'])."px'";}?>> | |
| 12 | - <div class="uwp-account-avatar"><a href="<?php echo $profile_link;?>"><?php echo get_avatar( get_current_user_id(), 100 ); ?></a></div> | |
| 12 | + <div class="uwp-account" <?php if(!empty($args['form_padding'])){echo "style='padding:".absint($args['form_padding'])."px'";}?>> | |
| 13 | + <div class="uwp-account-avatar"><a href="<?php echo esc_url( $profile_link );?>"><?php echo get_avatar( get_current_user_id(), 100 ); ?></a></div> | |
| 13 | 14 | <?php do_action('uwp_template_form_title_before', 'dashboard'); ?> |
| 14 | 15 | <h2><?php |
| 15 | - echo apply_filters('uwp_template_form_title', $hello_text, 'dashboard'); | |
| 16 | + echo apply_filters('uwp_template_form_title', esc_attr( $hello_text ), 'dashboard'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 16 | 17 | ?></h2> |
| 17 | 18 | <?php do_action('uwp_template_form_title_after', 'dashboard'); ?> |
| 18 | 19 | <?php do_action('uwp_template_display_notices', 'dashboard'); ?> |
| 19 | 20 | <div class="uwp-dashboard-links"> |
| 20 | 21 | <?php |
| 21 | - do_action('uwp_dashboard_links_before',$uwp_login_widget_args); | |
| 22 | - | |
| 23 | - $dashboard_links = array( | |
| 24 | - 'placeholder' => array( | |
| 25 | - 'url' => '', | |
| 26 | - 'text' => __('Select an action','userswp'), | |
| 27 | - 'disabled' => true, | |
| 28 | - 'selected' => true, | |
| 29 | - 'display_none' => true | |
| 30 | - ) | |
| 31 | - ); | |
| 22 | + do_action('uwp_dashboard_links_before',$args); | |
| 32 | 23 | |
| 33 | - $dashboard_links['uwp_profile'][] = array( | |
| 34 | - 'optgroup' => 'open', | |
| 35 | - 'text' => esc_attr( __( 'My Profile', 'userswp' ) ) | |
| 36 | - ); | |
| 37 | - $dashboard_links['uwp_profile'][] = array( | |
| 38 | - 'url' => uwp_build_profile_tab_url( $user_id ), | |
| 39 | - 'text' => esc_attr( __( 'View Profile', 'userswp' ) ) | |
| 40 | - ); | |
| 41 | - $account_page = uwp_get_page_id('account_page', false); | |
| 42 | - $account_link = get_permalink( $account_page ); | |
| 43 | - if($account_link){ | |
| 44 | - $dashboard_links['uwp_profile'][] = array( | |
| 45 | - 'url' => $account_link, | |
| 46 | - 'text' => esc_attr( __( 'Edit Profile', 'userswp' ) ) | |
| 47 | - ); | |
| 48 | - } | |
| 49 | - | |
| 50 | - $dashboard_links['uwp_profile'][] = array( | |
| 51 | - 'optgroup' => 'close', | |
| 52 | - ); | |
| 53 | - $dashboard_links = apply_filters( 'uwp_dashboard_links',$dashboard_links,$uwp_login_widget_args); | |
| 54 | - | |
| 55 | -// print_r($dashboard_links); | |
| 56 | 24 | global $userswp; |
| 57 | 25 | $userswp->forms->output_dashboard_links( $dashboard_links ); |
| 58 | 26 | |
| 59 | - do_action('uwp_dashboard_links_after',$uwp_login_widget_args); | |
| 27 | + do_action('uwp_dashboard_links_after',$args); | |
| 60 | 28 | ?> |
| 61 | 29 | </div> |
| 62 | 30 | <div class="uwp-login-links"> |
| 63 | 31 | <div class="uwp-logout-link"> |
| 64 | - <?php | |
| 65 | - $template = new UsersWP_Templates(); | |
| 66 | - $logout_url = $template->uwp_logout_url(); | |
| 67 | - printf(__( '<a href="%1$s">Log out</a>', 'userswp'), esc_url( $logout_url )); | |
| 68 | - ?> | |
| 32 | + <a href="<?php echo esc_url( wp_logout_url() );?>"><?php esc_html_e("Logout","userswp");?></a> | |
| 69 | 33 | </div> |
| 70 | 34 | </div> |
| 71 | 35 | |
| 72 | 36 | </div> |