[buddypress-trac] [BuddyPress Trac] #6278: Attachment Library

buddypress-trac noreply at wordpress.org
Wed Mar 4 17:13:02 UTC 2015


#6278: Attachment Library
------------------------------------+------------------
 Reporter:  imath                   |       Owner:
     Type:  enhancement             |      Status:  new
 Priority:  normal                  |   Milestone:  2.3
Component:  API                     |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |
------------------------------------+------------------

Comment (by imath):

 Thanks a lot for your feedback boonebgorges :)

 My initial thought was that this class could be used when setting up
 globals in the component in order to set once and for all the avatar
 uploads dir. That's what is currently done in
 `bp_core_set_avatar_globals()`when setting the upload path. I understood
 this was done to avoid switching blog too many times. Then,  you're right,
 the second reason was that i wanted to be sure the `$bp->avatar` was like
 before, reason of the unit test.

 But i think you're completely right. What i've done, means each time a
 component would use the class, it would actually switch blog. So that's
 not that great. I guess, we could have a core function to set this in a
 global once and for all, this way we'd eventually be sure to do only one
 switch blog and the BP_Attachment base class could use this function.

 @johnjamesjacoby, thanks a lot for your feedback too :)

 I agree with both of you about having a very generic BP_Attachment class
 that can be extended by the avatar/component.
 - (folders, dimensions, file-sizes, maximum allowed?) and mime types for
 example
 - about `wp_mkdir_p()` & the 'bp_attachment_upload_dir' filter : you're
 absolutely right

 > Do we need to do the switch_to_blog()dance?
 i'll check but i think so, else it might create folders in sub blogs file
 system `uploads/sites/{$blog_id}`. But as mentioned above in my comment,
 if we make sure to do it once, then i think it's ok.

 i'll work on version 2 of the patch, asap :)

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6278#comment:5>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list