bbp_get_reply_edit_link( mixed $args = '' )

Return the edit link of the reply

Description

Parameters

$args

(mixed) (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

	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.