Making WordPress.org

Changeset 7674


Ignore:
Timestamp:
09/19/2018 03:33:33 AM (5 years ago)
Author:
dd32
Message:

Toolbar: Link the (w) and (w)->About links to the localised WordPress.org About pages.

Previously the logged out versions of these were redirected to /about/ which didn't make sense on the make blog or other non-rosetta subdomains.

Fixes #3812.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/wporg-admin-bar.php

    r7543 r7674  
    55
    66/**
    7  * Makes Logo and About menu items link to the w.org/about/ page for logged-out users.
     7 * Makes Logo and About menu items link to the localised w.org/about/ page for all users.
    88 *
    99 * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance, passed by reference.
    1010 */
    11 function wporg_logged_out_admin_bar( $wp_admin_bar ) {
    12     if ( is_user_logged_in() ) {
    13         return;
    14     }
    15 
     11function wporg_about_links_in_admin_bar( $wp_admin_bar ) {
    1612    $nodes = [
    1713        $wp_admin_bar->get_node( 'wp-logo' ),
     
    1915    ];
    2016
     17    $about_url = 'https://wordpress.org/about/';
     18
     19    if ( class_exists( 'Rosetta_Sites' ) && is_object( $GLOBALS['rosetta'] ) ) {
     20        $about_url = 'https://' . $GLOBALS['rosetta']->current_site_domain . '/about/';
     21    }
     22
    2123    foreach ( $nodes as $node ) {
    22         $node->href = '/about/';
     24        $node->href = $about_url;
    2325
    2426        $wp_admin_bar->add_node( $node );
    2527    }
    2628}
    27 add_action( 'admin_bar_menu', 'wporg_logged_out_admin_bar', 11 );
     29add_action( 'admin_bar_menu', 'wporg_about_links_in_admin_bar', 11 );
Note: See TracChangeset for help on using the changeset viewer.