bp_document_user_document_folder_tree_view_li_html (intuser_id美元,intgroup_id美元)
返回面包屑。
描述
参数
- user_id美元
-
(int)(必需)
- group_id美元
-
(int)(必需)
返回
(字符串)
源
文件:bp-document / bp-document-functions.php
函数bp_document_user_document_folder_tree_view_li_html($user_id = 0, $group_id = 0) {global $wpdb, $bp;document_folder_table =美元bp - >文档- > table_name_folder;If (0 === $group_id) {$group_id = (function_exists('bp_get_current_group_id')) ?bp_get_current_group_id (): 0;} $documents_folder_query = $wpdb->prepare("SELECT * FROM {$document_folder_table} WHERE user_id = %d AND group_id = %d ORDER BY id DESC", $user_id, $group_id);$data = $wpdb->get_results($documents_folder_query, ARRAY_A);// db调用ok;no - cache好;//创建项目引用数组:foreach ($data as $key => &$item) {$itemsByReference[$item['id']] = &$item;// Children数组:$itemsByReference[$item['id']][' Children '] = array(); // Children数组:$itemsByReference[$item['id']][' Children '] = array(); // Empty data class (so that json_encode adds "data: {}" ) $itemsByReference[ $item['id'] ]['data'] = new StdClass(); } // Set items as children of the relevant parent item. foreach ( $data as $key => &$item ) { if ( $item['parent'] && isset( $itemsByReference[ $item['parent'] ] ) ) { $itemsByReference [ $item['parent'] ]['children'][] = &$item; } } // Remove items that were added to parents elsewhere: foreach ( $data as $key => &$item ) { if ( $item['parent'] && isset( $itemsByReference[ $item['parent'] ] ) ) { unset( $data[ $key ] ); } } return bp_document_folder_recursive_li_list( $data, false ); }
更新日志
版本 | 描述 |
---|---|
BuddyBoss 1.4.0 | 介绍了。 |