bp_get_document_link( int $document_id )
Return the document link.
Description
Parameters
- $document_id
-
(int) (Required) Document ID.
Return
(mixed|void)
Source
File: bp-document/bp-document-template.php
function bp_get_document_link( $document_id ) { $document = new BP_Document( $document_id ); if ( isset( $document ) && isset( $document->group_id ) && $document->group_id > 0 ) { $group = groups_get_group( $document->group_id ); $group_link = bp_get_group_permalink( $group ); if ( $document->folder_id > 0 ) { $url = trailingslashit( $group_link . 'documents/folders/' . $document->folder_id ); } else { $url = trailingslashit( $group_link . 'documents/' ); } } elseif ( isset( $document ) && isset( $document->folder_id ) && $document->folder_id > 0 ) { $url = trailingslashit( bp_core_get_user_domain( $document->user_id ) . 'document/folders/' . $document->folder_id ); } else { $url = trailingslashit( bp_core_get_user_domain( $document->user_id ) . 'documents/' ); } /** * Filters the document link * @since BuddyBoss 1.4.0 * * @param string $url The document folder description. * @param int $document_id The document id. */ return apply_filters( 'bp_get_document_link', $url, $document_id ); }
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.