bp_document_upload()
Create and upload the document file.
Description
Return
(array|null|WP_Error|WP_Post)
Source
File: bp-document/bp-document-functions.php
1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 | function bp_document_upload() { /** * Make sure user is logged in. */ if ( ! is_user_logged_in() ) { return new WP_Error( 'not_logged_in' , __( 'Please login in order to upload file document.' , 'buddyboss' ), array ( 'status' => 500 ) ); } $attachment = bp_document_upload_handler(); if ( is_wp_error( $attachment ) ) { return $attachment ; } $name = $attachment ->post_name; $result = array ( 'id' => (int) $attachment ->ID, 'url' => esc_url( $attachment ->guid ), 'name' => esc_attr( pathinfo ( basename ( get_attached_file( (int) $attachment ->ID ) ), PATHINFO_FILENAME ) ), 'type' => esc_attr( 'document' ), ); return $result ; } |
Changelog
Version | Description |
---|---|
BuddyBoss 1.4.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.