Changeset 8354
- Timestamp:
- 02/27/2019 02:06:22 PM (5 years ago)
- Location:
- sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins
- Files:
-
- 1 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/wcorg-login-message.php
r3873 r8354 39 39 40 40 /** 41 * Set the locale on the login screen42 *43 * Currently all logins are funneled through the main site, so they're all in English by default. That sucks for44 * international users, so this overrides the main site's locale and uses the one from the site that they're45 * logging into instead.46 *47 * @todo This can be removed after the subdirectory migration.48 *49 * @param string $locale50 * @return string51 */52 function wcorg_login_message_locale( $locale ) {53 if ( is_main_network() && false !== strpos( $_SERVER['SCRIPT_NAME'], '/wp-login.php' ) ) {54 $locale = wcorg_get_login_locale( $locale );55 }56 57 return $locale;58 }59 add_filter( 'locale', 'wcorg_login_message_locale' );60 61 /**62 41 * Override the default login message. 63 42 * … … 70 49 */ 71 50 function wcorg_login_message( $message, $redirect_to = false ) { 72 $locale = wcorg_get_login_locale();51 $locale = get_locale(); 73 52 $registration_url = wcorg_get_wporg_forums_url( $locale, 'register' ); 74 53 … … 115 94 } 116 95 add_filter( 'login_message', 'wcorg_login_message' ); 117 118 /**119 * Get the locale used by the site that the user is logging in to.120 *121 * @todo After subdirectory migration, users will login at city.wordcamp.org/year/wp-login.php instead of being122 * redirected through the main site, so change this to pull from current site's locale instead of using redirect_to123 *124 * @return string125 */126 function wcorg_get_login_locale( $locale = 'en_US' ) {127 if ( ! empty( $_REQUEST['redirect_to'] ) ) {128 $url = parse_url( $_REQUEST['redirect_to'] );129 130 if ( isset( $url['host'] ) ) {131 $blog_details = get_blog_details( array( 'domain' => $url['host'] ), false );132 133 if ( $wplang = get_blog_option( $blog_details->blog_id, 'WPLANG' ) ) {134 $locale = $wplang;135 }136 }137 }138 139 return $locale;140 }141 142 96 143 97 /**
Note: See TracChangeset
for help on using the changeset viewer.