Skip to:
Content

BuddyPress.org

Changeset 10372


Ignore:
Timestamp:
11/21/2015 04:07:12 PM (5 years ago)
Author:
imath
Message:

Prevent notice errors in bp_attachments_uploads_dir_get() that are happening when wp_upload_dir() returns an error.

Fixes #6729 (trunk)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-attachments.php

    r10356 r10372  
    4242    } else {
    4343        $upload_data = bp_upload_dir();
     44
     45        // Return empty string, if Uploads data are not available
     46        if ( ! $upload_data ) {
     47            return $retval;
     48        }
    4449
    4550        // Build the Upload data array for BuddyPress attachments.
     
    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';
     
    402412    // Get BuddyPress Attachments Uploads Dir datas.
    403413    $bp_attachments_uploads_dir = bp_attachments_uploads_dir_get();
     414
     415    // The BP Attachments Uploads Dir is not set, stop.
     416    if ( ! $bp_attachments_uploads_dir ) {
     417        return $attachment_data;
     418    }
    404419
    405420    $type_subdir = $r['object_dir'] . '/' . $r['item_id'] . '/' . $r['type'];
     
    12341249    $bp_attachments_uploads_dir = bp_attachments_uploads_dir_get();
    12351250
     1251    // The BP Attachments Uploads Dir is not set, stop.
     1252    if ( ! $bp_attachments_uploads_dir ) {
     1253        bp_attachments_json_response( false, $is_html4, array(
     1254            'type'    => 'upload_error',
     1255            'message' => $error_message,
     1256        ) );
     1257    }
     1258
    12361259    $cover_subdir = $object_data['dir'] . '/' . $bp_params['item_id'] . '/cover-image';
    12371260    $cover_dir    = trailingslashit( $bp_attachments_uploads_dir['basedir'] ) . $cover_subdir;
Note: See TracChangeset for help on using the changeset viewer.