Making WordPress.org

Changeset 8354


Ignore:
Timestamp:
02/27/2019 02:06:22 PM (5 years ago)
Author:
iandunn
Message:

WordCamp Global Login: Remove the unnecessary funnel through the main site.

The login funnel was added because, at the time, 4th-level domains didn't have SSL certificates. Now that they do, this is no longer needed.

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  
    3939
    4040/**
    41  * Set the locale on the login screen
    42  *
    43  * Currently all logins are funneled through the main site, so they're all in English by default. That sucks for
    44  * international users, so this overrides the main site's locale and uses the one from the site that they're
    45  * logging into instead.
    46  *
    47  * @todo This can be removed after the subdirectory migration.
    48  *
    49  * @param string $locale
    50  * @return string
    51  */
    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 /**
    6241 * Override the default login message.
    6342 *
     
    7049 */
    7150function wcorg_login_message( $message, $redirect_to = false ) {
    72     $locale           = wcorg_get_login_locale();
     51    $locale           = get_locale();
    7352    $registration_url = wcorg_get_wporg_forums_url( $locale, 'register' );
    7453
     
    11594}
    11695add_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 being
    122  * redirected through the main site, so change this to pull from current site's locale instead of using redirect_to
    123  *
    124  * @return string
    125  */
    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 
    14296
    14397/**
Note: See TracChangeset for help on using the changeset viewer.