Skip to:
Content

bbPress.org

Ticket #2828: 2828.diff

File 2828.diff, 952 bytes (added by tharsheblows, 10 years ago)

don't allow user queries by email address and, if permalinks active, by id

  • src/includes/core/template-functions.php

     
    511511                // Setup the default user variable
    512512                $the_user = false;
    513513
    514                 // If using pretty permalinks, use the email or slug
     514                // If using pretty permalinks, use the slug
    515515                if ( get_option( 'permalink_structure' ) ) {
    516 
    517                         // Email was passed
    518                         if ( is_email( $bbp_user ) ) {
    519                                 $the_user = get_user_by( 'email', $bbp_user );
    520 
    521                         // Try nicename
    522                         } else {
    523                                 $the_user = get_user_by( 'slug', $bbp_user );
    524                         }
     516                        $the_user = get_user_by( 'slug', $bbp_user );
    525517                }
    526518
    527519                // No user found by slug/email, so try the ID if it's numeric
    528                 if ( empty( $the_user ) && is_numeric( $bbp_user ) ) {
     520                elseif ( is_numeric( $bbp_user ) ) {
    529521                        $the_user = get_user_by( 'id', $bbp_user );
    530522                }
    531523