Introduces the BuddyPress Attachments API
BP_Attachment
is a new class custom and core components can extend to manage file uploads.
- It is taking care of setting the uploads data (path, url..)
- It is creating the specific base uploads directory for the component if requested
- It is taking care of uploading the files into the uploads directory
- Custom validation rules can be set in order to for instance: restrict mime types or file size
- If, like avatars, cropping an image file is needed, the class includes a crop method to help you.
bp_upload_dir()
is also a new function to make sure the uploads data will always be the one of the site BuddyPress is activated on (the root site).
Props johnjamesjacoby, boonebgorges
See #6278