Skip to:
Content

BuddyPress.org

Changeset 2856


Ignore:
Timestamp:
03/19/2010 09:51:12 AM (14 years ago)
Author:
apeatling
Message:

Fixes issues with displaying profiles when the user_username and user_nicename are different values.

Location:
branches/1.2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/bp-core.php

    r2855 r2856  
    998998    global $wpdb;
    999999
    1000     if ( !empty( $username ) )
    1001         return apply_filters( 'bp_core_get_userid', $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . CUSTOM_USER_TABLE . " WHERE user_login = %s", $username ) ) );
     1000    if ( empty( $username ) )
     1001        return false;
     1002
     1003    return apply_filters( 'bp_core_get_userid', $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . CUSTOM_USER_TABLE . " WHERE user_login = %s", $username ) ) );
     1004}
     1005
     1006/**
     1007 * bp_core_get_userid_from_nicename()
     1008 *
     1009 * Returns the user_id for a user based on their user_nicename.
     1010 *
     1011 * @package BuddyPress Core
     1012 * @param $username str Username to check.
     1013 * @global $wpdb WordPress DB access object.
     1014 * @return false on no match
     1015 * @return int the user ID of the matched user.
     1016 */
     1017function bp_core_get_userid_from_nicename( $user_nicename ) {
     1018    global $wpdb;
     1019
     1020    if ( empty( $user_nicename ) )
     1021        return false;
     1022
     1023    return apply_filters( 'bp_core_get_userid_from_nicename', $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . CUSTOM_USER_TABLE . " WHERE user_nicename = %s", $user_nicename ) ) );
    10021024}
    10031025
  • branches/1.2/bp-core/bp-core-catchuri.php

    r2695 r2856  
    104104        if ( ( $bp_uri[0] == BP_MEMBERS_SLUG && !empty( $bp_uri[1] ) ) || in_array( 'wp-load.php', $bp_uri ) ) {
    105105            // We are within a member page, set up user id globals
    106             $displayed_user_id = bp_core_get_displayed_userid( $bp_uri[1] );
     106            if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) )
     107                $displayed_user_id = bp_core_get_userid( $bp_uri[1] );
     108            else
     109                $displayed_user_id = bp_core_get_userid_from_nicename( $bp_uri[1] );
    107110
    108111            unset($bp_uri[0]);
     
    118121
    119122            // We are within a member page, set up user id globals
    120             $displayed_user_id = bp_core_get_displayed_userid( $bp_uri[0] );
     123            if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) )
     124                $displayed_user_id = bp_core_get_userid( $bp_uri[1] );
     125            else
     126                $displayed_user_id = bp_core_get_userid_from_nicename( $bp_uri[1] );
    121127
    122128            unset($bp_uri[0]);
Note: See TracChangeset for help on using the changeset viewer.