| @@ -6,9 +6,9 @@ | ||
| 6 | 6 | * |
| 7 | 7 | * @return void |
| 8 | 8 | */ |
| 9 | 9 | function wppb_show_hide_admin_bar_submenu_page() { |
| 10 | - add_submenu_page( 'profile-builder', __( 'Show/Hide the Admin Bar on the Front-End', 'profilebuilder' ), __( 'Admin Bar Settings', 'profilebuilder' ), 'manage_options', 'profile-builder-admin-bar-settings', 'wppb_show_hide_admin_bar_content' ); | |
| 10 | + add_submenu_page( 'profile-builder', __( 'Show/Hide the Admin Bar on the Front-End', 'profile-builder' ), __( 'Admin Bar Settings', 'profile-builder' ), 'manage_options', 'profile-builder-admin-bar-settings', 'wppb_show_hide_admin_bar_content' ); | |
| 11 | 11 | } |
| 12 | 12 | add_action( 'admin_menu', 'wppb_show_hide_admin_bar_submenu_page', 4 ); |
| 13 | 13 | |
| 14 | 14 | |
| @@ -43,10 +43,10 @@ | ||
| 43 | 43 | ?> |
| 44 | 44 | |
| 45 | 45 | <div class="wrap wppb-wrap wppb-admin-bar"> |
| 46 | 46 | |
| 47 | - <h2><?php _e( 'Admin Bar Settings', 'profilebuilder' );?></h2> | |
| 48 | - <p><?php _e( 'Chose which user roles view the admin bar in the front-end of the website.', 'profilebuilder' ); ?> | |
| 47 | + <h2><?php _e( 'Admin Bar Settings', 'profile-builder' );?></h2> | |
| 48 | + <p><?php _e( 'Choose which user roles view the admin bar in the front-end of the website.', 'profile-builder' ); ?> | |
| 49 | 49 | <form method="post" action="options.php#show-hide-admin-bar"> |
| 50 | 50 | <?php |
| 51 | 51 | $admin_bar_settings = get_option( 'wppb_display_admin_settings' ); |
| 52 | 52 | settings_fields( 'wppb_display_admin_settings' ); |
| @@ -53,10 +53,10 @@ | ||
| 53 | 53 | ?> |
| 54 | 54 | <table class="widefat"> |
| 55 | 55 | <thead> |
| 56 | 56 | <tr> |
| 57 | - <th class="row-title" scope="col"><?php _e('User-Role', 'profilebuilder');?></th> | |
| 58 | - <th scope="col"><?php _e('Visibility', 'profilebuilder');?></th> | |
| 57 | + <th class="row-title" scope="col"><?php _e('User-Role', 'profile-builder');?></th> | |
| 58 | + <th scope="col"><?php _e('Visibility', 'profile-builder');?></th> | |
| 59 | 59 | </tr> |
| 60 | 60 | </thead> |
| 61 | 61 | <tbody> |
| 62 | 62 | <?php |
| @@ -67,13 +67,13 @@ | ||
| 67 | 67 | $setting_exists = !empty( $admin_bar_settings[$key] ); |
| 68 | 68 | $alt_class = ( ( $alt_i%2 == 0 ) ? ' class="alternate"' : '' ); |
| 69 | 69 | |
| 70 | 70 | echo'<tr'.$alt_class.'> |
| 71 | - <td>'.$key.'</td> | |
| 71 | + <td>'.translate_user_role($key).'</td> | |
| 72 | 72 | <td> |
| 73 | - <span><input id="rd'.$key.'" type="radio" name="wppb_display_admin_settings['.$key.']" value="default"'.( ( !$setting_exists || $admin_bar_settings[$key] == 'default' ) ? ' checked' : '' ).'/><label for="rd'.$key.'">'.__( 'Default', 'profilebuilder' ).'</label></span> | |
| 74 | - <span><input id="rs'.$key.'" type="radio" name="wppb_display_admin_settings['.$key.']" value="show"'.( ( $setting_exists && $admin_bar_settings[$key] == 'show') ? ' checked' : '' ).'/><label for="rs'.$key.'">'.__( 'Show', 'profilebuilder' ).'</label></span> | |
| 75 | - <span><input id="rh'.$key.'" type="radio" name="wppb_display_admin_settings['.$key.']" value="hide"'.( ( $setting_exists && $admin_bar_settings[$key] == 'hide') ? ' checked' : '' ).'/><label for="rh'.$key.'">'.__( 'Hide', 'profilebuilder' ).'</label></span> | |
| 73 | + <span><input id="rd'.$key.'" type="radio" name="wppb_display_admin_settings['.$key.']" value="default"'.( ( !$setting_exists || $admin_bar_settings[$key] == 'default' ) ? ' checked' : '' ).'/><label for="rd'.$key.'">'.__( 'Default', 'profile-builder' ).'</label></span> | |
| 74 | + <span><input id="rs'.$key.'" type="radio" name="wppb_display_admin_settings['.$key.']" value="show"'.( ( $setting_exists && $admin_bar_settings[$key] == 'show') ? ' checked' : '' ).'/><label for="rs'.$key.'">'.__( 'Show', 'profile-builder' ).'</label></span> | |
| 75 | + <span><input id="rh'.$key.'" type="radio" name="wppb_display_admin_settings['.$key.']" value="hide"'.( ( $setting_exists && $admin_bar_settings[$key] == 'hide') ? ' checked' : '' ).'/><label for="rh'.$key.'">'.__( 'Hide', 'profile-builder' ).'</label></span> | |
| 76 | 76 | </td> |
| 77 | 77 | </tr>'; |
| 78 | 78 | } |
| 79 | 79 | ?> |
| @@ -104,16 +104,18 @@ | ||
| 104 | 104 | $wppb_general_settings = get_option( 'wppb_general_settings' ); |
| 105 | 105 | |
| 106 | 106 | if ( isset( $wppb_general_settings['loginWith'] ) && ( $wppb_general_settings['loginWith'] == 'email' ) ){ |
| 107 | 107 | $current_user = wp_get_current_user(); |
| 108 | - | |
| 109 | - $my_account_main = $wp_admin_bar->get_node( 'my-account' ); | |
| 110 | - $new_title1 = str_replace( $current_user->display_name, $current_user->user_email, $my_account_main->title ); | |
| 111 | - $wp_admin_bar->add_node( array( 'id' => 'my-account', 'title' => $new_title1 ) ); | |
| 112 | - | |
| 113 | - $my_account_sub = $wp_admin_bar->get_node( 'user-info' ); | |
| 114 | - $wp_admin_bar->add_node( array( 'parent' => 'user-actions', 'id' => 'user-info', 'title' => get_avatar( $current_user->ID, 64 )."<span class='display-name'>{$current_user->user_email}</span>", 'href' => get_edit_profile_url( $current_user->ID ), 'meta' => array( 'tabindex' => -1 ) ) ); | |
| 108 | + | |
| 109 | + if ( $current_user->ID != 0 ) { | |
| 110 | + $my_account_main = $wp_admin_bar->get_node('my-account'); | |
| 111 | + $new_title1 = str_replace($current_user->display_name, $current_user->user_email, $my_account_main->title); | |
| 112 | + $wp_admin_bar->add_node(array('id' => 'my-account', 'title' => $new_title1)); | |
| 113 | + | |
| 114 | + $my_account_sub = $wp_admin_bar->get_node('user-info'); | |
| 115 | + $wp_admin_bar->add_node(array('parent' => 'user-actions', 'id' => 'user-info', 'title' => get_avatar($current_user->ID, 64) . "<span class='display-name'>{$current_user->user_email}</span>", 'href' => get_edit_profile_url($current_user->ID), 'meta' => array('tabindex' => -1))); | |
| 116 | + } | |
| 115 | 117 | } |
| 116 | 118 | |
| 117 | 119 | return $wp_admin_bar; |
| 118 | 120 | } |
| 119 | 121 | add_filter( 'admin_bar_menu', 'wppb_replace_username_on_admin_bar', 25 ); |