bbp_get_reply_edit_link( array $args = array() )
Return the edit link of the reply
Description Description
Parameters Parameters
- $args
-
(Optional) This function supports these arguments: - id: Reply id - link_before: HTML before the link - link_after: HTML after the link - edit_text: Edit text. Defaults to 'Edit'
Default value: array()
Return Return
(string) Reply edit link
Source Source
File: includes/replies/template.php
function bbp_get_reply_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_reply_edit_link' ); // Get reply $reply = bbp_get_reply( $r['id'] ); // Bypass check if user has caps if ( ! current_user_can( 'edit_others_replies' ) ) { // User cannot edit or it is past the lock time if ( empty( $reply ) || ! current_user_can( 'edit_reply', $reply->ID ) || bbp_past_edit_lock( $reply->post_date_gmt ) ) { return; } } // Get uri $uri = bbp_get_reply_edit_url( $r['id'] ); // Bail if no uri if ( empty( $uri ) ) { return; } $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-reply-edit-link">' . $r['edit_text'] . '</a>' . $r['link_after']; // Filter & return return apply_filters( 'bbp_get_reply_edit_link', $retval, $r, $args ); }
Changelog Changelog
Version | Description |
---|---|
2.0.0 | Introduced. |