[buddypress-trac] [BuddyPress Trac] #7265: uploads dir should filtered for cover images

buddypress-trac noreply at wordpress.org
Wed Sep 21 15:31:52 UTC 2016

#7265: uploads dir should filtered for cover images
 Reporter:  m_uysl        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Core          |    Version:
 Severity:  normal        |   Keywords:
 I used `bp_attachments_cover_image_upload_dir` for changing default cover-
 image path and it works, I can see the file into correct folder but AJAX
 callback gives error.

 // hard-coded filter
 add_filter( 'bp_attachments_cover_image_upload_dir', function (
 $upload_dir ) {
         return array(
                 'path'    => '/Applications/MAMP/htdocs/wordpress/wp-
                 'url'     => 'http://wordpress.dev/wp-content/uploads
                 'subdir'  => '/2016/09/21/mustafa',
                 'basedir' => '/Applications/MAMP/htdocs/wordpress/wp-
                 'baseurl' => 'http://wordpress.dev/wp-content/uploads
                 'error'   => false,
 } );

 I realized that callback fails from
 `bp_attachments_cover_image_generate_file` because
 `bp_attachments_cover_image_ajax_upload` gets uploads dir from

 So in this case, overriding the default AJAX callback with
 `bp_attachments_pre_cover_image_ajax_upload` filter is current solution.

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7265>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac

More information about the buddypress-trac mailing list