Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/06/2015 11:53:33 PM (11 years ago)
Author:
imath
Message:

Allow class extending the BP_Attachment class to get the original WordPress upload dir within their upload_dir_filter() method.

To do so, you simply need to add the argument $upload_dir_filter_args to the array you use inside your constructor and set it to 1.

Props rittesh.patel

Fixes #6591

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/classes/class-bp-attachment-cover-image.php

    r10178 r10194  
    9494         * @since 2.4.0
    9595         *
     96         * @param  array $upload_dir The original Uploads dir.
    9697         * @return array upload data (path, url, basedir...)
    9798         */
    98         public function upload_dir_filter() {
     99        public function upload_dir_filter( $upload_dir = array() ) {
    99100                // Default values are for profiles
    100101                $object_id = bp_displayed_user_id();
    … …  
    115116                $subdir  = '/' . $object_directory . '/' . $object_id . '/cover-image';
    116117
    117                 return apply_filters( 'bp_attachments_cover_image_upload_datas', array(
     118                /**
     119                 * Filters the cover image upload directory.
     120                 *
     121                 * @since 2.4.0
     122                 *
     123                 * @param array $value       Array containing the path, URL, and other helpful settings.
     124                 * @param array $upload_dir The original Uploads dir.
     125                 */
     126                return apply_filters( 'bp_attachments_cover_image_upload_dir', array(
    118127                        'path'    => $this->upload_path . $subdir,
    119128                        'url'     => $this->url . $subdir,
    … …  
    122131                        'baseurl' => $this->url,
    123132                        'error'   => false
    124                 ) );
     133                ), $upload_dir );
    125134        }
    126135
Note: See TracChangeset for help on using the changeset viewer.