Ticket #2317: avatar-path-and-url-fix-jjj.patch
| File avatar-path-and-url-fix-jjj.patch, 5.3 KB (added by , 16 years ago) |
|---|
-
bp-core/bp-core-avatars.php
108 108 else 109 109 $html_height = ( 'thumb' == $type ) ? ' height="' . BP_AVATAR_THUMB_HEIGHT . '"' : ' height="' . BP_AVATAR_FULL_HEIGHT . '"'; 110 110 111 $avatar_folder_url = apply_filters( 'bp_core_avatar_folder_url', str_replace( WP_CONTENT_DIR, BP_AVATAR_URL, BP_AVATAR_UPLOAD_PATH ). '/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir );111 $avatar_folder_url = apply_filters( 'bp_core_avatar_folder_url', BP_AVATAR_URL . '/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir ); 112 112 $avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', BP_AVATAR_UPLOAD_PATH . '/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir ); 113 113 114 114 /**** … … 300 300 } 301 301 302 302 /* Set the url value for the image */ 303 $bp->avatar_admin->image->url = str_replace( WP_CONTENT_DIR, BP_AVATAR_URL, $bp->avatar_admin->image->dir );303 $bp->avatar_admin->image->url = str_replace( BP_AVATAR_UPLOAD_PATH, BP_AVATAR_URL, $bp->avatar_admin->image->dir ); 304 304 305 305 return true; 306 306 } … … 333 333 if ( !$original_file ) 334 334 return false; 335 335 336 if ( !file_exists( WP_CONTENT_DIR . '/' . $original_file ) ) 336 if ( is_multisite () ) 337 $original_file = WP_CONTENT_DIR . str_replace( BP_AVATAR_URL, BP_AVATAR_UPLOAD_PATH, $original_file ); 338 else 339 $original_file = str_replace( BP_AVATAR_URL, BP_AVATAR_UPLOAD_PATH, $original_file ); 340 341 if ( !file_exists( $original_file ) ) 337 342 return false; 338 343 339 344 if ( !$item_id ) 340 $avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', WP_CONTENT_DIR. dirname( $original_file ), $item_id, $object, $avatar_dir );345 $avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', BP_AVATAR_UPLOAD_PATH . dirname( $original_file ), $item_id, $object, $avatar_dir ); 341 346 else 342 347 $avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', BP_AVATAR_UPLOAD_PATH . '/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir ); 343 348 … … 362 367 $thumb_filename = wp_hash( $original_file . time() ) . '-bpthumb.jpg'; 363 368 364 369 /* Crop the image */ 365 $full_cropped = wp_crop_image( WP_CONTENT_DIR .$original_file, (int)$crop_x, (int)$crop_y, (int)$crop_w, (int)$crop_h, BP_AVATAR_FULL_WIDTH, BP_AVATAR_FULL_HEIGHT, false, $avatar_folder_dir . '/' . $full_filename );366 $thumb_cropped = wp_crop_image( WP_CONTENT_DIR .$original_file, (int)$crop_x, (int)$crop_y, (int)$crop_w, (int)$crop_h, BP_AVATAR_THUMB_WIDTH, BP_AVATAR_THUMB_HEIGHT, false, $avatar_folder_dir . '/' . $thumb_filename );370 $full_cropped = wp_crop_image( $original_file, (int)$crop_x, (int)$crop_y, (int)$crop_w, (int)$crop_h, BP_AVATAR_FULL_WIDTH, BP_AVATAR_FULL_HEIGHT, false, $avatar_folder_dir . '/' . $full_filename ); 371 $thumb_cropped = wp_crop_image( $original_file, (int)$crop_x, (int)$crop_y, (int)$crop_w, (int)$crop_h, BP_AVATAR_THUMB_WIDTH, BP_AVATAR_THUMB_HEIGHT, false, $avatar_folder_dir . '/' . $thumb_filename ); 367 372 368 373 /* Remove the original */ 369 @unlink( WP_CONTENT_DIR .$original_file );374 @unlink( $original_file ); 370 375 371 376 return true; 372 377 } … … 413 418 } 414 419 415 420 function bp_core_avatar_upload_path() { 416 if ( bp_core_is_multisite() ) 417 $path = ABSPATH . get_blog_option( BP_ROOT_BLOG, 'upload_path' ); 418 else { 419 if ( !$path = get_option( 'upload_path' ) ) 420 $path = WP_CONTENT_DIR . '/uploads'; 421 else 422 $path = ABSPATH . $path; 423 } 424 425 return apply_filters( 'bp_core_avatar_upload_path', $path ); 421 $upload_dir = wp_upload_dir(); 422 return apply_filters( 'bp_core_avatar_upload_path', $upload_dir['basedir'] ); 426 423 } 427 424 428 425 function bp_core_avatar_url() { 429 if ( !bp_core_is_multisite() ) 430 return WP_CONTENT_URL; 431 432 return apply_filters( 'bp_core_avatar_url', get_blog_option( BP_ROOT_BLOG, 'siteurl' ) ); 426 $upload_dir = wp_upload_dir(); 427 return apply_filters( 'bp_core_avatar_url', $upload_dir['baseurl'] ); 433 428 } 434 429 435 430 ?> 431 No newline at end of file -
bp-core/bp-core-signup.php
519 519 if ( !file_exists( $path ) ) 520 520 @wp_mkdir_p( $path ); 521 521 522 $newurl = str_replace( BP_AVATAR_UPLOAD_PATH, BP_AVATAR_URL, $path );522 $newurl = BP_AVATAR_URL . '/avatars/signups/' . $bp->signup->avatar_dir; 523 523 $newburl = $newurl; 524 524 $newsubdir = '/avatars/signups/' . $bp->signup->avatar_dir; 525 525 -
bp-groups.php
1860 1860 if ( !file_exists( $path ) ) 1861 1861 @wp_mkdir_p( $path ); 1862 1862 1863 $newurl = str_replace( BP_AVATAR_UPLOAD_PATH, BP_AVATAR_URL, $path );1863 $newurl = BP_AVATAR_URL . '/group-avatars/' . $group_id; 1864 1864 $newburl = $newurl; 1865 1865 $newsubdir = '/group-avatars/' . $group_id; 1866 1866 -
bp-xprofile.php
879 879 if ( !file_exists( $path ) ) 880 880 @wp_mkdir_p( $path ); 881 881 882 $newurl = str_replace( BP_AVATAR_UPLOAD_PATH, BP_AVATAR_URL, $path );882 $newurl = BP_AVATAR_URL . '/avatars/' . $user_id; 883 883 $newburl = $newurl; 884 884 $newsubdir = '/avatars/' . $user_id; 885 885