bp_nouveau_ajax_document_edit_folder ()
重命名文件夹。
描述
源
文件:bp-templates / bp-nouveau /包括/文档/ ajax.php
function bp_nouveau_ajax_document_edit_folder() {$response = array('feedback' => sprintf('', 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 ); } if ( empty( $_POST['title'] ) ) { $response['feedback'] = sprintf( '', esc_html__( 'Please enter title of folder.', 'buddyboss' ) ); wp_send_json_error( $response ); } if ( strpbrk( $_POST['title'], "\\/?%*:|\"<>" ) !== false ) { $response['feedback'] = sprintf( '%s
', esc_html__( 'Invalid folder name', 'buddyboss' ) ); wp_send_json_error( $response ); } // save folder. $title = $_POST['title']; $id = ! empty( $_POST['id'] ) ? (int) $_POST['id'] : 0; $group_id = ! empty( $_POST['group_id'] ) ? (int) $_POST['group_id'] : 0; if ( (int) $id > 0 ) { $has_access = bp_folder_user_can_edit( $id ); if ( ! $has_access ) { $response['feedback'] = sprintf( '%s
', esc_html__( 'You don\'t have permission to rename this folder', 'buddyboss' ) ); wp_send_json_error( $response ); } } if ( ! empty( $_POST['privacy'] ) ) { $privacy = $_POST['privacy']; } else { $folder_id = bp_document_get_root_parent_id( $_POST['id'] ); $folder = new BP_Document_Folder( $folder_id ); $privacy = $folder->privacy; } if ( $group_id > 0 ) { $privacy = 'grouponly'; } $folder_id = bp_document_rename_folder( $id, $title, $privacy ); if ( ! $folder_id ) { $response['feedback'] = sprintf( '%s
', esc_html__( 'There was a problem when trying to rename the folder.', 'buddyboss' ) ); wp_send_json_error( $response ); } wp_send_json_success( array( 'message' => 'success', ) ); }%s
更新日志
版本 | 描述 |
---|---|
BuddyBoss 1.4.0 | 介绍了。 |