bbp_get_topic_edit_link( array $args = array() )
Return the edit link of the topic
Description Description
Parameters Parameters
- $args
-
(Optional) This function supports these args: - id: Optional. Topic id - link_before: Before the link - link_after: After the link - edit_text: Edit text
Default value: array()
Return Return
(string) Topic edit link
Source Source
File: includes/topics/template.php
function bbp_get_topic_edit_link( $args = array() ) { // Parse arguments against default values $r = bbp_parse_args( $args, array( 'id' => 0, 'link_before' => '', 'link_after' => '', 'edit_text' => esc_html__( 'Edit', 'bbpress' ) ), 'get_topic_edit_link' ); // Get the topic $topic = bbp_get_topic( $r['id'] ); // Bypass check if user has caps if ( ! current_user_can( 'edit_others_topics' ) ) { // User cannot edit or it is past the lock time if ( empty( $topic ) || ! current_user_can( 'edit_topic', $topic->ID ) || bbp_past_edit_lock( $topic->post_date_gmt ) ) { return; } } // Get uri $uri = bbp_get_topic_edit_url( $topic->ID ); // Bail if no uri if ( empty( $uri ) ) { return; } $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-edit-link">' . $r['edit_text'] . '</a>' . $r['link_after']; // Filter & return return apply_filters( 'bbp_get_topic_edit_link', $retval, $r, $args ); }
Changelog Changelog
Version | Description |
---|---|
2.0.0 | Introduced. |