bp_document_create_folder_recursive( $array, bool $parent_folder )
This function will give the breadcrumbs ul li html.
Description
Parameters
- $array
-
(Required)
- $parent_folder
-
(Required)
Return
(string)
Source
File: bp-templates/bp-nouveau/includes/document/functions.php
function bp_document_create_folder_recursive( $array, $parent_folder ) { // Base case: an empty array produces no list. if ( empty( $array ) || empty( $parent_folder ) ) { return ''; } foreach ( $array as $item ) { $id = $item['id']; $title = $item['title']; $child = $item['children']; // Create given main parent folder. $sub_parent_folder = $parent_folder . '/' . $title; wp_mkdir_p( $sub_parent_folder ); // Fetch all the attachments of the parent folder. $get_current_attachments = bp_document_get_folder_attachment_ids( $id ); if ( ! empty( $get_current_attachments ) ) { foreach ( $get_current_attachments as $attachment ) { $the_file = get_attached_file( $attachment->attachment_id ); $file_name = basename( $the_file ); copy( $the_file, $sub_parent_folder . '/' . $file_name ); } } if ( ! empty( $child ) ) { bp_document_create_folder_recursive( $child, $sub_parent_folder ); } } }
Changelog
Version | Description |
---|---|
BuddyBoss 1.4.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.