bbp_get_reply_edit_link( mixed $args = '' )

Return the edit link of the reply

Description

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: ''

Return

(string) Reply edit link

Source

File: bp-forums/replies/template.php

1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
function bbp_get_reply_edit_link( $args = '' ) {
 
    // Parse arguments against default values
    $r = bbp_parse_args( $args, array(
        'id'           => 0,
        'link_before'  => '',
        'link_after'   => '',
        'edit_text'    => esc_html__( 'Edit', 'buddyboss' )
    ), 'get_reply_edit_link' );
 
    $reply = bbp_get_reply( bbp_get_reply_id( (int) $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'];
 
    return apply_filters( 'bbp_get_reply_edit_link', $retval, $r );
}

Changelog

Changelog
Version Description
bbPress (r2740) 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.