$item_ids, 'user_id' => false ) ); $redirect_to = add_query_arg( 'deleted', count( $deleted ), $redirect_to ); bp_core_redirect( $redirect_to ); } elseif ( 'edit' == $doaction && ! empty( $_GET['bid'] ) ) { // columns screen option add_screen_option( 'layout_columns', array( 'default' => 2, 'max' => 2, ) ); get_current_screen()->add_help_tab( array( 'id' => 'buddydrive-edit-overview', 'title' => __( 'Overview', 'buddydrive' ), 'content' => '
' . __( 'This page is a convenient way to edit the details associated with one of your file or folder.', 'buddydrive' ) . '
' . '' . __( 'The Name and Description box is fixed in place, but you can reposition all the other boxes using drag and drop, and can minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to hide or unhide, or to choose a 1- or 2-column layout for this screen.', 'buddydrive' ) . '
' ) ); // Register metaboxes for the edit screen. add_meta_box( 'submitdiv', _x( 'Save', 'buddydrive-item admin edit screen', 'buddydrive' ), 'buddydrive_admin_edit_metabox_status', get_current_screen()->id, 'side', 'high' ); add_meta_box( 'buddydrive_item_privacy', _x( 'Privacy', 'buddydrive-item admin edit screen', 'buddydrive' ), 'buddydrive_admin_edit_metabox_privacy', get_current_screen()->id, 'side', 'core' ); add_meta_box( 'buddydrive_item_children', _x( 'Files', 'buddydrive-item admin edit screen', 'buddydrive' ), 'buddydrive_admin_edit_metabox_list_files', get_current_screen()->id, 'normal', 'core' ); do_action( 'buddydrive_files_admin_meta_boxes' ); // Enqueue javascripts wp_enqueue_script( 'postbox' ); wp_enqueue_script( 'dashboard' ); wp_enqueue_script( 'comment' ); // Index screen } else { $buddydrive_list_table = new BuddyDrive_List_Table(); } if ( $doaction && 'save' == $doaction ) { // Get item ID $item_id = isset( $_REQUEST['bid'] ) ? (int) $_REQUEST['bid'] : ''; $redirect_to = add_query_arg( array( 'bid' => (int) $item_id, 'action' => 'edit' ), $redirect_to ); // Check this is a valid form submission check_admin_referer( 'edit-buddydrive-item_' . $item_id ); $item = buddydrive_get_buddyfile( $item_id, array( buddydrive_get_folder_post_type(), buddydrive_get_file_post_type() ) ); if ( empty( $item->title ) ) { wp_redirect( $redirect_to ); exit; } $args = array(); if( !empty( $_POST['buddydrive-edit']['item-title'] ) ) $args['title'] = wp_kses( $_POST['buddydrive-edit']['item-title'], array() ); if( !empty( $_POST['buddydrive-edit']['item-content'] ) ) $args['content'] = wp_kses( $_POST['buddydrive-edit']['item-content'], array() ); if( !empty( $_POST['buddydrive-edit']['sharing'] ) ) $args['privacy'] = $_POST['buddydrive-edit']['sharing']; if( !empty( $_POST['buddydrive-edit']['password'] ) ) $args['password'] = wp_kses( $_POST['buddydrive-edit']['password'], array() ); if( !empty( $_POST['buddydrive-edit']['buddygroup'] ) ) $args['group'] = $_POST['buddydrive-edit']['buddygroup']; $args['parent_folder_id'] = !empty( $_POST['buddydrive-edit']['folder'] ) ? intval( $_POST['buddydrive-edit']['folder'] ) : 0 ; $updated = buddydrive_update_item( $args, $item ); if( !empty( $updated ) ) $redirect_to = add_query_arg( 'updated', 1, $redirect_to ); else $redirect_to = add_query_arg( 'error', 1, $redirect_to ); wp_redirect( apply_filters( 'buddydrive_item_admin_edit_redirect', $redirect_to ) ); exit; } } /** * Choose the right section to display * * @uses buddydrive_files_admin_edit() to load the edit page of a single item * @uses buddydrive_files_admin_delete() to request for a confirmation * @uses buddydrive_files_admin_index() to load the list of BuddyDrive items */ function buddydrive_files_admin() { // Decide whether to load the index or edit screen $doaction = ! empty( $_REQUEST['action'] ) ? $_REQUEST['action'] : ''; if ( ! empty( $_REQUEST['action2'] ) && $_REQUEST['action2'] != "-1" ) { $doaction = $_REQUEST['action2']; } // Display the single item edit screen if ( 'edit' == $doaction && ! empty( $_GET['bid'] ) ) { buddydrive_files_admin_edit(); // Display the item deletion confirmation screen } else if ( 'delete' == $doaction && ! empty( $_GET['bid'] ) ) { buddydrive_files_admin_delete(); // Otherwise, display the items index screen } else { buddydrive_files_admin_index(); } } /** * The list of BuddyDrive items * * @global object $buddydrive_list_table * @global string $plugin_page * @uses BuddyDrive_List_Table::prepare_items() to prepare the BuddyDrive items for display * @uses screen_icon() to display BuddyDrive icon * @uses wp_html_excerpt truncate the string provided * @uses esc_html sanitize the string * @uses BuddyDrive_List_Table::views() to display the available views * @uses BuddyDrive_List_Table::search_box() to display the search box * @uses BuddyDrive_List_Table::display() to display each item on its own row */ function buddydrive_files_admin_index() { global $buddydrive_list_table, $plugin_page; $messages = array(); // If the user has just made a change to an item, build status messages if ( ! empty( $_REQUEST['deleted'] ) ) { $deleted = ! empty( $_REQUEST['deleted'] ) ? (int) $_REQUEST['deleted'] : 0; if ( $deleted > 0 ) { $messages[] = sprintf( _n( '%s item has been permanently deleted.', '%s items have been permanently deleted.', $deleted, 'buddydrive' ), number_format_i18n( $deleted ) ); } } // Prepare the BuddyDrive items for display $buddydrive_list_table->prepare_items(); // Call an action for plugins to modify the messages before we display the edit form do_action( 'buddydrive_files_admin_index', $messages ); ?>\n", $messages ); ?>
\n", $messages ); ?>
Go back and try again.', 'buddydrive' ), esc_url( bp_get_admin_url( 'admin.php?page=buddydrive-files' ) ) ); ?>
: % |
folder", "buddydrive"), esc_url( add_query_arg( array( 'page' => 'buddydrive-files', 'bid' => $item->post_parent, 'action' => 'edit'), bp_get_admin_url( 'admin.php' ) ) ) );?>