| 1 |
<?php do_action('uwp_template_before', 'dashboard'); |
| 2 |
$user_id = get_current_user_id(); |
| 3 |
$user_info = get_userdata($user_id); |
| 4 |
$display_name = $user_info->data->display_name; |
| 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>"; |
| 8 |
$hello_text = sprintf($hello_text,$display_name); |
| 9 |
?> |
| 10 |
<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> |
| 13 |
<?php do_action('uwp_template_form_title_before', 'dashboard'); ?> |
| 14 |
<h2><?php |
| 15 |
echo apply_filters('uwp_template_form_title', $hello_text, 'dashboard'); |
| 16 |
?></h2> |
| 17 |
<?php do_action('uwp_template_form_title_after', 'dashboard'); ?> |
| 18 |
<?php do_action('uwp_template_display_notices', 'dashboard'); ?> |
| 19 |
<div class="uwp-dashboard-links"> |
| 20 |
<?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 |
); |
| 32 |
|
| 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 |
global $userswp; |
| 57 |
$userswp->forms->output_dashboard_links( $dashboard_links ); |
| 58 |
|
| 59 |
do_action('uwp_dashboard_links_after',$uwp_login_widget_args); |
| 60 |
?> |
| 61 |
</div> |
| 62 |
<div class="uwp-login-links"> |
| 63 |
<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 |
?> |
| 69 |
</div> |
| 70 |
</div> |
| 71 |
|
| 72 |
</div> |
| 73 |
</div> |
| 74 |
<?php do_action('uwp_template_after', 'dashboard'); ?> |