<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][9624] trunk/src/bp-core/bp-core-avatars.php: Adapts Avatars core functions so that they use the `BP_Attachment_Avatar` class.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://buddypress.trac.wordpress.org/changeset/9624">9624</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://buddypress.trac.wordpress.org/changeset/9624","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>imath</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2015-03-17 18:32:58 +0000 (Tue, 17 Mar 2015)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Adapts Avatars core functions so that they use the `BP_Attachment_Avatar` class.
Props johnjamesjacoby, boonebgorges
See <a href="http://buddypress.trac.wordpress.org/ticket/6278">#6278</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcbpcorebpcoreavatarsphp">trunk/src/bp-core/bp-core-avatars.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcbpcorebpcoreavatarsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-core/bp-core-avatars.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-core/bp-core-avatars.php 2015-03-17 18:20:07 UTC (rev 9623)
+++ trunk/src/bp-core/bp-core-avatars.php 2015-03-17 18:32:58 UTC (rev 9624)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -564,8 +564,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @see bp_core_check_avatar_upload()
</span><span class="cx" style="display: block; padding: 0 10px"> * @see bp_core_check_avatar_type()
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param array $file The appropriate entry the from $_FILES superglobal.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param array $file The appropriate entry the from $_FILES superglobal.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string $upload_dir_filter A filter to be applied to 'upload_dir'.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return bool True on success, false on failure.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_core_avatar_handle_upload( $file, $upload_dir_filter ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -574,98 +575,35 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * You may want to hook into this filter if you want to override this function.
</span><span class="cx" style="display: block; padding: 0 10px"> * Make sure you return false.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( !apply_filters( 'bp_core_pre_avatar_handle_upload', true, $file, $upload_dir_filter ) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! apply_filters( 'bp_core_pre_avatar_handle_upload', true, $file, $upload_dir_filter ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return true;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- require_once( ABSPATH . '/wp-admin/includes/file.php' );
-
- $uploadErrors = array(
- 0 => __( 'The image was uploaded successfully', 'buddypress' ),
- 1 => __( 'The image exceeds the maximum allowed file size of: ', 'buddypress' ) . size_format( bp_core_avatar_original_max_filesize() ),
- 2 => __( 'The image exceeds the maximum allowed file size of: ', 'buddypress' ) . size_format( bp_core_avatar_original_max_filesize() ),
- 3 => __( 'The uploaded file was only partially uploaded.', 'buddypress' ),
- 4 => __( 'The image was not uploaded.', 'buddypress' ),
- 6 => __( 'Missing a temporary folder.', 'buddypress' )
- );
-
- if ( ! bp_core_check_avatar_upload( $file ) ) {
- bp_core_add_message( sprintf( __( 'Your upload failed. Please try again. Error was: %s', 'buddypress' ), $uploadErrors[$file['file']['error']] ), 'error' );
- return false;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! bp_core_check_avatar_size( $file ) ) {
- bp_core_add_message( sprintf( __( 'The file you uploaded is too big. Please upload a file under %s', 'buddypress' ), size_format( bp_core_avatar_original_max_filesize() ) ), 'error' );
- return false;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Setup some variables
+ $bp = buddypress();
+ $upload_path = bp_core_avatar_upload_path();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! bp_core_check_avatar_type( $file ) ) {
- bp_core_add_message( __( 'Please upload only JPG, GIF or PNG photos.', 'buddypress' ), 'error' );
- return false;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Upload the file
+ $avatar_attachment = new BP_Attachment_Avatar();
+ $bp->avatar_admin->original = $avatar_attachment->upload( $file, $upload_dir_filter );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Filter the upload location
- add_filter( 'upload_dir', $upload_dir_filter, 10, 0 );
-
- $bp = buddypress();
-
- $bp->avatar_admin->original = wp_handle_upload( $file['file'], array( 'action'=> 'bp_avatar_upload' ) );
-
- // Remove the upload_dir filter, so that other upload URLs on the page
- // don't break
- remove_filter( 'upload_dir', $upload_dir_filter, 10, 0 );
-
- // Move the file to the correct upload location.
- if ( !empty( $bp->avatar_admin->original['error'] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // In case of an error, stop the process and display a feedback to the user
+ if ( ! empty( $bp->avatar_admin->original['error'] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> bp_core_add_message( sprintf( __( 'Upload Failed! Error was: %s', 'buddypress' ), $bp->avatar_admin->original['error'] ), 'error' );
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Get image size
- $size = @getimagesize( $bp->avatar_admin->original['file'] );
- $error = false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Maybe resize
+ $bp->avatar_admin->resized = $avatar_attachment->shrink( $bp->avatar_admin->original['file'] );
+ $bp->avatar_admin->image = new stdClass();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Check image size and shrink if too large
- if ( $size[0] > bp_core_avatar_original_max_width() ) {
- $editor = wp_get_image_editor( $bp->avatar_admin->original['file'] );
-
- if ( ! is_wp_error( $editor ) ) {
- $editor->set_quality( 100 );
-
- $resized = $editor->resize( bp_core_avatar_original_max_width(), bp_core_avatar_original_max_width(), false );
- if ( ! is_wp_error( $resized ) ) {
- $thumb = $editor->save( $editor->generate_filename() );
- } else {
- $error = $resized;
- }
-
- // Check for thumbnail creation errors
- if ( false === $error && is_wp_error( $thumb ) ) {
- $error = $thumb;
- }
-
- // Thumbnail is good so proceed
- if ( false === $error ) {
- $bp->avatar_admin->resized = $thumb;
- }
-
- } else {
- $error = $editor;
- }
-
- if ( false !== $error ) {
- bp_core_add_message( sprintf( __( 'Upload Failed! Error was: %s', 'buddypress' ), $error->get_error_message() ), 'error' );
- return false;
- }
- }
-
- if ( ! isset( $bp->avatar_admin->image ) )
- $bp->avatar_admin->image = new stdClass();
-
</del><span class="cx" style="display: block; padding: 0 10px"> // We only want to handle one image after resize.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $bp->avatar_admin->resized ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $bp->avatar_admin->image->dir = str_replace( bp_core_avatar_upload_path(), '', $bp->avatar_admin->original['file'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $bp->avatar_admin->image->file = $bp->avatar_admin->original['file'];
+ $bp->avatar_admin->image->dir = str_replace( $upload_path, '', $bp->avatar_admin->original['file'] );
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $bp->avatar_admin->image->dir = str_replace( bp_core_avatar_upload_path(), '', $bp->avatar_admin->resized['path'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $bp->avatar_admin->image->file = $bp->avatar_admin->resized['path'];
+ $bp->avatar_admin->image->dir = str_replace( $upload_path, '', $bp->avatar_admin->resized['path'] );
</ins><span class="cx" style="display: block; padding: 0 10px"> @unlink( $bp->avatar_admin->original['file'] );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -675,13 +613,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // If the uploaded image is smaller than the "full" dimensions, throw
- // a warning
- $uploaded_image = @getimagesize( bp_core_avatar_upload_path() . buddypress()->avatar_admin->image->dir );
- $full_width = bp_core_avatar_full_width();
- $full_height = bp_core_avatar_full_height();
- if ( isset( $uploaded_image[0] ) && $uploaded_image[0] < $full_width || $uploaded_image[1] < $full_height ) {
- bp_core_add_message( sprintf( __( 'You have selected an image that is smaller than recommended. For best results, upload a picture larger than %d x %d pixels.', 'buddypress' ), $full_width, $full_height ), 'error' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // If the uploaded image is smaller than the "full" dimensions, throw a warning
+ if ( $avatar_attachment->is_too_small( $bp->avatar_admin->image->file ) ) {
+ bp_core_add_message( sprintf( __( 'You have selected an image that is smaller than recommended. For best results, upload a picture larger than %d x %d pixels.', 'buddypress' ), bp_core_avatar_full_width(), bp_core_avatar_full_height() ), 'error' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Set the url value for the image
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -738,80 +672,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * You may want to hook into this filter if you want to override this function.
</span><span class="cx" style="display: block; padding: 0 10px"> * Make sure you return false.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( !apply_filters( 'bp_core_pre_avatar_handle_crop', true, $r ) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! apply_filters( 'bp_core_pre_avatar_handle_crop', true, $r ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return true;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- extract( $r, EXTR_SKIP );
-
- if ( empty( $original_file ) )
- return false;
-
- $original_file = bp_core_avatar_upload_path() . $original_file;
-
- if ( !file_exists( $original_file ) )
- return false;
-
- if ( empty( $item_id ) ) {
- $avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', dirname( $original_file ), $item_id, $object, $avatar_dir );
- } else {
- $avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', bp_core_avatar_upload_path() . '/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir );
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( !file_exists( $avatar_folder_dir ) )
- return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Crop the file
+ $avatar_attachment = new BP_Attachment_Avatar();
+ $cropped = $avatar_attachment->crop( $r );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- require_once( ABSPATH . '/wp-admin/includes/image.php' );
- require_once( ABSPATH . '/wp-admin/includes/file.php' );
-
- // Delete the existing avatar files for the object
- $existing_avatar = bp_core_fetch_avatar( array(
- 'object' => $object,
- 'item_id' => $item_id,
- 'html' => false,
- ) );
-
- if ( ! empty( $existing_avatar ) ) {
- // Check that the new avatar doesn't have the same name as the
- // old one before deleting
- $upload_dir = wp_upload_dir();
- $existing_avatar_path = str_replace( $upload_dir['baseurl'], '', $existing_avatar );
- $new_avatar_path = str_replace( $upload_dir['basedir'], '', $original_file );
-
- if ( $existing_avatar_path !== $new_avatar_path ) {
- bp_core_delete_existing_avatar( array( 'object' => $object, 'item_id' => $item_id, 'avatar_path' => $avatar_folder_dir ) );
- }
- }
-
-
-
- // Make sure we at least have a width and height for cropping
- if ( empty( $crop_w ) ) {
- $crop_w = bp_core_avatar_full_width();
- }
-
- if ( empty( $crop_h ) ) {
- $crop_h = bp_core_avatar_full_height();
- }
-
- // Get the file extension
- $data = @getimagesize( $original_file );
- $ext = $data['mime'] == 'image/png' ? 'png' : 'jpg';
-
- // Set the full and thumb filenames
- $full_filename = wp_hash( $original_file . time() ) . '-bpfull.' . $ext;
- $thumb_filename = wp_hash( $original_file . time() ) . '-bpthumb.' . $ext;
-
- // Crop the image
- $full_cropped = wp_crop_image( $original_file, (int) $crop_x, (int) $crop_y, (int) $crop_w, (int) $crop_h, bp_core_avatar_full_width(), bp_core_avatar_full_height(), false, $avatar_folder_dir . '/' . $full_filename );
- $thumb_cropped = wp_crop_image( $original_file, (int) $crop_x, (int) $crop_y, (int) $crop_w, (int) $crop_h, bp_core_avatar_thumb_width(), bp_core_avatar_thumb_height(), false, $avatar_folder_dir . '/' . $thumb_filename );
-
</del><span class="cx" style="display: block; padding: 0 10px"> // Check for errors
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( empty( $full_cropped ) || empty( $thumb_cropped ) || is_wp_error( $full_cropped ) || is_wp_error( $thumb_cropped ) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( empty( $cropped['full'] ) || empty( $cropped['thumb'] ) || is_wp_error( $cropped['full'] ) || is_wp_error( $cropped['thumb'] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Remove the original
- @unlink( $original_file );
-
</del><span class="cx" style="display: block; padding: 0 10px"> return true;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -926,16 +799,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Fetch data from the BP root blog's upload directory.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Handy for multisite instances because all uploads are made on the BP root
- * blog and we need to query the BP root blog for the upload directory data.
- *
- * This function ensures that we only need to use {@link switch_to_blog()}
- * once to get what we need.
- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @since BuddyPress (1.8.0)
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @uses wp_upload_dir()
- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @param string $type The variable we want to return from the $bp->avatars
</span><span class="cx" style="display: block; padding: 0 10px"> * object. Only 'upload_path' and 'url' are supported. Default: 'upload_path'.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string The avatar upload directory path.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -977,17 +842,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // No cache, so query for it
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // We need to switch to the root blog on multisite installs
- if ( is_multisite() ) {
- switch_to_blog( bp_get_root_blog_id() );
- }
</del><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Get upload directory information from current site
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $upload_dir = wp_upload_dir();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $upload_dir = bp_upload_dir();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Will bail if not switched
- restore_current_blog();
-
</del><span class="cx" style="display: block; padding: 0 10px"> // Stash upload directory data for later use
</span><span class="cx" style="display: block; padding: 0 10px"> $bp->avatar->upload_dir = $upload_dir;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1018,7 +876,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Get the absolute upload path for the WP installation.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @uses wp_upload_dir To get upload directory info
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @uses bp_core_get_upload_dir() To get upload directory info
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string Absolute path to WP upload directory.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1029,7 +887,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Get the raw base URL for root site upload location.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @uses wp_upload_dir To get upload directory info.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @uses bp_core_get_upload_dir() To get upload directory info.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string Full URL to current upload location.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span></span></pre>
</div>
</div>
</body>
</html>