WordPress.org

Making WordPress.org

Changeset 3465


Ignore:
Timestamp:
06/19/2016 11:46:59 AM (5 years ago)
Author:
obenland
Message:

Plugin Directory: Set favorite user as a query var for a more personalized message later on.

See #1719.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php

    r3456 r3465  
    427427        switch ( get_query_var( 'browse' ) ) {
    428428            case 'favorites':
    429                 $favorites_user = get_current_user_id();
     429                $favorites_user = wp_get_current_user();
    430430                if ( !empty( $wp_query->query_vars['favorites_user'] ) ) {
    431431                    $favorites_user = $wp_query->query_vars['favorites_user'];
     
    433433                    $favorites_user = $_GET['favorites_user'];
    434434                }
    435                 if ( ! is_numeric( $favorites_user ) ) {
     435
     436                if ( ! $favorites_user instanceof \WP_User ) {
    436437                    $favorites_user = get_user_by( 'slug', $favorites_user );
    437                     if ( $favorites_user ) {
    438                         $favorites_user = $favorites_user->ID;
    439                     }
    440438                }
    441439
    442440                if ( $favorites_user ) {
    443                     $wp_query->query_vars['post_name__in'] = get_user_meta( $favorites_user, 'plugin_favorites', true );
     441                    $wp_query->query_vars['favorites_user'] = $favorites_user->user_nicename;
     442                    $wp_query->query_vars['post_name__in']  = get_user_meta( $favorites_user->ID, 'plugin_favorites', true );
    444443                }
     444
    445445                if ( ! $favorites_user || ! $wp_query->query_vars['post_name__in'] ) {
    446446                    $wp_query->query_vars['p'] = -1;
Note: See TracChangeset for help on using the changeset viewer.