Skip to:
Content

BuddyPress.org

Ticket #508: bp-core-nicola-patch.diff

File bp-core-nicola-patch.diff, 4.3 KB (added by nicolagreco, 16 years ago)

Patch file to replace get_userdata with get_usermeta

  • bp-core.php

     
    345345       
    346346        if ( !$user_id ) return;
    347347       
    348         $ud = get_userdata($user_id);
     348        $ud = get_usermeta($user_id);
    349349       
    350350        return $bp->root_domain . '/' . MEMBERS_SLUG . '/' . $ud->user_login . '/';
    351351}
     
    570570        if ( $bp->current_component == MEMBERS_SLUG && isset( $_GET['random'] ) ) {
    571571                $user = BP_Core_User::get_random_users(1);
    572572
    573                 $ud = get_userdata( $user['users'][0]->user_id );
     573                $ud = get_usermeta( $user['users'][0]->user_id );
    574574                bp_core_redirect( $bp->root_domain . '/' . MEMBERS_SLUG . '/' . $ud->user_login );
    575575        }
    576576}
     
    618618 * @package BuddyPress Core
    619619 * @param $uid int User ID to check.
    620620 * @global $userdata WordPress user data for the current logged in user.
    621  * @uses get_userdata() WordPress function to fetch the userdata for a user ID
     621 * @uses get_usermeta() WordPress function to fetch the userdata for a user ID
    622622 * @return false on no match
    623623 * @return str the username of the matched user.
    624624 */
     
    628628        if ( $uid == $userdata->ID )
    629629                return 'You';
    630630       
    631         if ( !$ud = get_userdata($uid) )
     631        if ( !$ud = get_usermeta($uid) )
    632632                return false;
    633633               
    634634        return $ud->user_login;
     
    642642 * @package BuddyPress Core
    643643 * @param $uid int User ID to check.
    644644 * @global $userdata WordPress user data for the current logged in user.
    645  * @uses get_userdata() WordPress function to fetch the userdata for a user ID
     645 * @uses get_usermeta() WordPress function to fetch the userdata for a user ID
    646646 * @return false on no match
    647647 * @return str The URL for the user with no HTML formatting.
    648648 */
     
    652652        if ( !is_numeric($uid) )
    653653                return false;
    654654       
    655         $ud = get_userdata($uid);
     655        $ud = get_usermeta($uid);
    656656               
    657657        return $bp->root_domain . '/' . MEMBERS_SLUG . '/' . $ud->user_login . '/';
    658658}
     
    664664 *
    665665 * @package BuddyPress Core
    666666 * @param $uid int User ID to check.
    667  * @uses get_userdata() WordPress function to fetch the userdata for a user ID
     667 * @uses get_usermeta() WordPress function to fetch the userdata for a user ID
    668668 * @return false on no match
    669669 * @return str The email for the matched user.
    670670 */
    671671function bp_core_get_user_email( $uid ) {
    672         $ud = get_userdata($uid);
     672        $ud = get_usermeta($uid);
    673673        return $ud->user_email;
    674674}
    675675
     
    689689 * @param $just_link bool Disable full name and HTML and just return the URL text. Default false.
    690690 * @param $no_you bool Disable replacing full name with "You" when logged in user is equal to the current user. Default false.
    691691 * @global $userdata WordPress user data for the current logged in user.
    692  * @uses get_userdata() WordPress function to fetch the userdata for a user ID
     692 * @uses get_usermeta() WordPress function to fetch the userdata for a user ID
    693693 * @uses bp_fetch_user_fullname() Returns the full name for a user based on user ID.
    694694 * @uses bp_core_get_userurl() Returns the URL for the user with no anchor tag based on user ID
    695695 * @return false on no match
     
    698698function bp_core_get_userlink( $user_id, $no_anchor = false, $just_link = false, $deprecated = false, $with_s = false ) {
    699699        global $userdata;
    700700       
    701         $ud = get_userdata($user_id);
     701        $ud = get_usermeta($user_id);
    702702       
    703703        if ( !$ud )
    704704                return false;
     
    737737 * @param $user_id string The user ID of the user.
    738738 * @param
    739739 * @uses bp_fetch_user_fullname() Returns the full name for a user based on user ID.
    740  * @uses get_userdata() Fetches a new userdata object for the user ID passed.
     740 * @uses get_usermeta() Fetches a new userdata object for the user ID passed.
    741741 * @return Either the users full name, or the display name.
    742742 */
    743743function bp_core_global_user_fullname( $user_id ) {
    744744        if ( function_exists('bp_fetch_user_fullname') ) {
    745745                return bp_fetch_user_fullname( $user_id, false );
    746746        } else {
    747                 $ud = get_userdata($user_id);
     747                $ud = get_usermeta($user_id);
    748748                return $current_user->display_name;
    749749        }
    750750}
     
    789789 *
    790790 * @package BuddyPress Core
    791791 * @param $uid int User ID to check.
    792  * @uses get_userdata() WordPress function to fetch the userdata for a user ID
     792 * @uses get_usermeta() WordPress function to fetch the userdata for a user ID
    793793 * @return false on no match
    794794 * @return str The email for the matched user.
    795795 */