bp_nouveau_ajax_document_delete ()
Ajax删除文档。
描述
源
文件:bp-templates / bp-nouveau /包括/文档/ ajax.php
function bp_nouveau_ajax_document_delete() {$response = array('feedback' => sprintf('', esc_html__('执行此操作有问题。请再试一次。', 'buddyboss')),);//如果不是POST操作,则保释。如果(!Bp_is_post_request ()) {wp_send_json_error($response);} $id = !($_POST['id']) ?(int) filter_input(INPUT_POST, 'id', FILTER_VALIDATE_INT): 0;$ attachment_id = ! empty( $_POST['attachment_id'] ) ? (int) filter_input( INPUT_POST, 'attachment_id', FILTER_VALIDATE_INT ) : 0; $type = ! empty( $_POST['type'] ) ? filter_input( INPUT_POST, 'type', FILTER_SANITIZE_STRING ) : ''; $scope = ! empty( $_POST['scope'] ) ? filter_input( INPUT_POST, 'scope', FILTER_SANITIZE_STRING ) : ''; if ( '' === $type ) { wp_send_json_error( $response ); } if ( 'folder' === $type ) { if ( bp_folder_user_can_delete( $id ) ) { bp_folder_delete( array( 'id' => $id ) ); } } else { if ( bp_document_user_can_delete( $id ) ) { $args = array( 'id' => $id, 'attachment_id' => $attachment_id, ); bp_document_delete( $args ); } } $content = ''; ob_start(); $string = ''; if ( '' !== $scope && 'personal' === $scope ) { $string = '&scope=' . $scope; } if ( bp_has_document( bp_ajax_querystring( 'document' ) . $string ) ) : if ( empty( $_POST['page'] ) || 1 === (int) filter_input( INPUT_POST, 'page', FILTER_SANITIZE_STRING ) ) : ?>'success', 'html' => $content, ) ); }
更新日志
版本 | 描述 |
---|---|
BuddyBoss 1.4.0 | 介绍了。 |