bp_nouveau_ajax_document_move ()
Ajax文档。
描述
源
文件:bp-templates / bp-nouveau /包括/文档/ ajax.php
function bp_nouveau_ajax_document_move() {$response = array('feedback' => esc_html__('执行此操作有问题。请再试一次。', 'buddyboss'),);//如果不是POST操作,则保释。如果(!Bp_is_post_request ()) {wp_send_json_error($response);} if(空的($_POST['_wpnonce'])) {wp_send_json_error($response);} //使用默认nonce。$nonce = filter_input(INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING);检查美元=“bp_nouveau_media”; // Nonce check! if ( empty( $nonce ) || ! wp_verify_nonce( $nonce, $check ) ) { wp_send_json_error( $response ); } // Move document. $folder_id = ! empty( $_POST['folder_id'] ) ? (int) $_POST['folder_id'] : 0; $document_id = ! empty( $_POST['document_id'] ) ? (int) $_POST['document_id'] : 0; $group_id = ! empty( $_POST['group_id'] ) ? (int) $_POST['group_id'] : 0; if ( 0 === $document_id ) { wp_send_json_error( $response ); } if ( (int) $document_id > 0 ) { $has_access = bp_document_user_can_edit( $document_id ); if ( ! $has_access ) { $response['feedback'] = esc_html__( 'You don\'t have permission to move this document.', 'buddyboss' ); wp_send_json_error( $response ); } } if ( (int) $folder_id > 0 ) { $has_access = bp_folder_user_can_edit( $folder_id ); if ( ! $has_access ) { $response['feedback'] = esc_html__( 'You don\'t have permission to move this document.', 'buddyboss' ); wp_send_json_error( $response ); } } $document = bp_document_move_document_to_folder( $document_id, $folder_id, $group_id ); if ( $document > 0 ) { $content = ''; ob_start(); if ( bp_has_document( bp_ajax_querystring( 'document' ) ) ) : if ( empty( $_POST['page'] ) || 1 === (int) filter_input( INPUT_POST, 'page', FILTER_SANITIZE_STRING ) ) : ?>'success', 'html' => $content, ) ); } else { wp_send_json_error( $response ); } }
更新日志
版本 | 描述 |
---|---|
BuddyBoss 1.4.0 | 介绍了。 |