PluginProbe
Bogo / 2.6
Bogo v2.6
3.9.3 trunk 1.0 1.1 2.0 2.0.1 2.1 2.1.1 2.1.2 2.1.3 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3 2.5 2.6 2.6.1 2.7 2.8 2.8.1 2.9 3.0 3.0.1 All 52 releases
← All changes | includes/user.php +15 -5 2.52.6 View file →
@@ -7,10 +7,11 @@
7 7 function bogo_admin_bar_menu( $wp_admin_bar ) {
8 8 $current_locale = bogo_get_user_locale();
9 9 $current_language = bogo_get_language( $current_locale );
10 10
11 - if ( ! $current_language )
11 + if ( ! $current_language ) {
12 12 $current_language = $current_locale;
13 + }
13 14
14 15 $wp_admin_bar->add_menu( array(
15 16 'parent' => 'top-secondary',
16 17 'id' => 'bogo-user-locale',
@@ -17,8 +18,9 @@
17 18 'title' => '✔ ' . $current_language ) );
18 19
19 20 $available_languages = bogo_available_languages( array(
20 21 'exclude' => array( $current_locale ),
22 + 'exclude_enus_if_inactive' => true,
21 23 'current_user_can_access' => true ) );
22 24
23 25 foreach ( $available_languages as $locale => $lang ) {
24 26 $url = admin_url( 'profile.php?action=bogo-switch-locale&locale=' . $locale );
@@ -74,8 +76,9 @@
74 76
75 77 $locale = get_user_option( 'locale', $user_id );
76 78
77 79 if ( bogo_is_available_locale( $locale )
80 + && ( 'en_US' != $locale || ! bogo_get_prop( 'enus_deactivated' ) )
78 81 && user_can( $user_id, 'bogo_access_locale', $locale ) ) {
79 82 return $locale;
80 83 }
81 84
@@ -82,9 +85,12 @@
82 85 if ( user_can( $user_id, 'bogo_access_locale', $default_locale ) ) {
83 86 return $default_locale;
84 87 }
85 88
86 - foreach ( (array) bogo_available_locales() as $locale ) {
89 + $available_locales = bogo_available_locales( array(
90 + 'exclude_enus_if_inactive' => true ) );
91 +
92 + foreach ( $available_locales as $locale ) {
87 93 if ( user_can( $user_id, 'bogo_access_locale', $locale ) ) {
88 94 return $locale;
89 95 }
90 96 }
@@ -97,8 +103,12 @@
97 103
98 104 $user_id = absint( $user_id );
99 105 $meta_key = $wpdb->get_blog_prefix() . 'accessible_locale';
100 106
101 - return get_user_meta( $user_id, $meta_key );
107 + $locales = get_user_meta( $user_id, $meta_key );
108 +
109 + if ( bogo_get_prop( 'enus_deactivated' ) ) {
110 + $locales = array_diff( $locales, array( 'en_US' ) );
111 + }
112 +
113 + return $locales;
102 114 }
103 -
104 -?>