Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/02/2009 10:07:58 PM (17 years ago)
Author:
apeatling
Message:

Fixing registration and avatar bugs with old 1.0 themes in 1.1.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/deprecated/bp-core-deprecated.php

    r1984 r2025  
    712712}
    713713
     714function bp_core_handle_avatar_upload($file) {
     715        global $wp_upload_error;
     716       
     717        require_once( ABSPATH . '/wp-admin/includes/file.php' );
     718       
     719        // Change the upload file location to /avatars/user_id
     720        add_filter( 'upload_dir', 'xprofile_avatar_upload_dir' );
     721
     722        $res = wp_handle_upload( $file['file'], array('action'=>'slick_avatars') );
     723
     724        if ( !in_array('error', array_keys($res) ) ) {
     725                return $res['file'];
     726        } else {
     727                $wp_upload_error = $res['error'];
     728                return false;
     729        }
     730}
     731
     732function bp_core_resize_avatar( $file, $size = false ) {
     733        require_once( ABSPATH . '/wp-admin/includes/image.php' );
     734
     735        if ( !$size )
     736                $size = CORE_CROPPING_CANVAS_MAX;
     737
     738        $canvas = wp_create_thumbnail( $file, $size );
     739
     740        if ( $canvas->errors )
     741                return false;
     742
     743        return $canvas = str_replace( '//', '/', $canvas );
     744}
    714745
    715746/*** END OLD AVATAR CROPPING SUPPORT **************************/
Note: See TracChangeset for help on using the changeset viewer.