bp_document_folder_bradcrumb( $folder_id )
This function will give the breadcrumbs html.
Description
Parameters
- $folder_id
-
(Required)
Return
(string)
Source
File: bp-document/bp-document-functions.php
2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 | function bp_document_folder_bradcrumb( $folder_id ) { global $wpdb , $bp ; $document_folder_table = $bp ->document->table_name_folder; $documents_folder_query = $wpdb ->prepare( "SELECT c.* FROM ( SELECT @r AS _id, (SELECT @r := parent FROM { $document_folder_table } WHERE id = _id) AS parent, @l := @l + 1 AS level FROM (SELECT @r := %d, @l := 0) vars, { $document_folder_table } m WHERE @r <> 0) d JOIN { $document_folder_table } c ON d._id = c.id ORDER BY d.level ASC", $folder_id ); $data = $wpdb ->get_results( $documents_folder_query , ARRAY_A ); // db call ok; no-cache ok; $html = '' ; if ( ! empty ( $data ) ) { $data = array_reverse ( $data ); $html .= '<ul class="document-breadcrumb">' ; if ( bp_is_group() && bp_is_group_single() ) { $group = groups_get_group( array ( 'group_id' => bp_get_current_group_id() ) ); $link = bp_get_group_permalink( $group ) . bp_get_document_slug(); $html .= '<li><a href=" ' . $link . ' "> ' . __( 'Documents' , 'buddyboss' ) . '</a></li>' ; } else { $link = bp_displayed_user_domain() . bp_get_document_slug(); $html .= '<li><a href=" ' . $link . ' "> ' . __( 'Documents' , 'buddyboss' ) . '</a></li>' ; } if ( count ( $data ) > 3 ) { $html .= '<li>' . __( '...' , 'buddyboss' ) . '</li>' ; $data = array_slice ( $data , - 3 ); } foreach ( $data as $element ) { $link = '' ; $group_id = (int) $element [ 'group_id' ]; if ( 0 === $group_id ) { $link = bp_displayed_user_domain() . bp_get_document_slug() . '/folders/' . $element [ 'id' ]; } else { $group = groups_get_group( array ( 'group_id' => $group_id ) ); $link = bp_get_group_permalink( $group ) . bp_get_document_slug() . '/folders/' . $element [ 'id' ]; } $html .= '<li> <a href=" ' . $link . ' ">' . stripslashes ( $element [ 'title' ] ) . '</a></li>' ; } $html .= '</ul>' ; } return $html ; } |
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.