bp_document_add_handler(大批$文件=大批()那细绳$隐私='民众'那细绳$内容=''那㈡$ group_id.=错误的那㈡$ folder_id.=错误的的)
文档添加处理程序功能
描述
参数
- $文件
-
(大批的)(可选的)
默认值:array()
- $隐私
-
(细绳的)(可选的)
默认值:'public'
- $内容
-
(细绳的)(可选的)
默认值: ''
- $ group_id.
-
(㈡的)(可选的)
默认值:false
- $ folder_id.
-
(㈡的)(可选的)
默认值:false
返回
(混合|空隙)
来源
文件:bp-document / bp-document-clusers.php
函数bp_document_add_handler($ document = array()){global $ bp_document_upload_count;$ document_ids = array();if(!is_user_logging_in()){返回false;}如果(空($文件)&&!空($ _post ['document']))){$ documents = $ _post ['document'];$ privacy =!空($ _post ['privacy'])&& in_array($ _post ['privacy'],array_keys(bp_document_get_visibility_levels())))?$ _post ['privacy']:'公共';if(!空($文件)&& is_array($ documents)){//更新文档的计数以供以后使用。$ bp_document_upload_count = count($文件);//保存文档。 foreach ( $documents as $document ) { $attachment_data = get_post( $document['id'] ); $file = get_attached_file( $document['id'] ); $file_type = wp_check_filetype( $file ); $file_name = basename( $file ); $document_id = bp_document_add( array( 'attachment_id' => $document['id'], 'title' => $document['name'], 'folder_id' => ! empty( $document['folder_id'] ) ? $document['folder_id'] : false, 'group_id' => ! empty( $document['group_id'] ) ? $document['group_id'] : false, 'privacy' => ! empty( $document['privacy'] ) && in_array( $document['privacy'], array_merge( array_keys( bp_document_get_visibility_levels() ), array( 'message' ) ) ) ? $document['privacy'] : $privacy, 'menu_order' => ! empty( $document['menu_order'] ) ? $document['menu_order'] : 0, 'error_type' => 'wp_error', ) ); if ( ! empty( $document_id ) && ! is_wp_error( $document_id ) ) { bp_document_update_meta( $document_id, 'file_name', $file_name ); bp_document_update_meta( $document_id, 'extension', '.' . $file_type['ext'] ); } if ( $document_id ) { $document_ids[] = $document_id; } } } /** * Fires at the end of the execution of adding saving a document item, before returning the new document items in ajax response. * * @param array $document_ids document IDs. * @param array $documents Array of document from POST object or in function parameter. * * @since BuddyBoss 1.4.0 */ return apply_filters( 'bp_document_add_handler', $document_ids, (array) $documents ); }
变更乐
版本 | 描述 |
---|---|
Buddyboss 1.4.0. | 介绍。 |