Skip to:
Content

BuddyPress.org

Ticket #6729: 6729.patch

File 6729.patch, 2.0 KB (added by imath, 11 years ago)
  • src/bp-core/bp-core-attachments.php

    diff --git src/bp-core/bp-core-attachments.php src/bp-core/bp-core-attachments.php
    index 3cfc6a2..8e5fc1b 100644
    function bp_attachments_uploads_dir_get( $data = '' ) {  
    4242        } else {
    4343                $upload_data = bp_upload_dir();
    4444
     45                // Return empty string, if Uploads data are not available
     46                if ( ! $upload_data ) {
     47                        return $retval;
     48                }
     49
    4550                // Build the Upload data array for BuddyPress attachments
    4651                foreach ( $upload_data as $key => $value ) {
    4752                        if ( 'basedir' === $key || 'baseurl' === $key ) {
    function bp_attachments_create_item_type( $type = 'avatar', $args = array() ) {  
    303308        } elseif ( 'cover_image' === $type ) {
    304309                $attachment_data = bp_attachments_uploads_dir_get();
    305310
     311                // The BP Attachments Uploads Dir is not set, stop.
     312                if ( ! $attachment_data ) {
     313                        return false;
     314                }
     315
    306316                // Default to members for xProfile
    307317                $object_subdir = 'members';
    308318
    function bp_attachments_get_attachment( $data = 'url', $args = array() ) {  
    402412        // Get BuddyPress Attachments Uploads Dir datas
    403413        $bp_attachments_uploads_dir = bp_attachments_uploads_dir_get();
    404414
     415        // The BP Attachments Uploads Dir is not set, stop.
     416        if ( ! $bp_attachments_uploads_dir ) {
     417                return $attachment_data;
     418        }
     419
    405420        $type_subdir = $r['object_dir'] . '/' . $r['item_id'] . '/' . $r['type'];
    406421        $type_dir    = trailingslashit( $bp_attachments_uploads_dir['basedir'] ) . $type_subdir;
    407422
    function bp_attachments_cover_image_ajax_upload() {  
    12341249        // Get BuddyPress Attachments Uploads Dir datas
    12351250        $bp_attachments_uploads_dir = bp_attachments_uploads_dir_get();
    12361251
     1252        // The BP Attachments Uploads Dir is not set, stop.
     1253        if ( ! $bp_attachments_uploads_dir ) {
     1254                bp_attachments_json_response( false, $is_html4, array(
     1255                        'type'    => 'upload_error',
     1256                        'message' => $error_message,
     1257                ) );
     1258        }
     1259
    12371260        $cover_subdir = $object_data['dir'] . '/' . $bp_params['item_id'] . '/cover-image';
    12381261        $cover_dir    = trailingslashit( $bp_attachments_uploads_dir['basedir'] ) . $cover_subdir;
    12391262