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
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.