Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Moving a reply to a new topic

@robin-w

Moderator

found and fixed.

I’ve put the fix in my style pack plugin version 4.5.0

bbp style pack

once activated go to

dashboard>settings>bbp style pack>bug fixes

or put this in your child theme’s function file – or use

Code Snippets

add_filter ('bbp_get_topic_merge_link', 'rew_get_topic_merge_link' , 10 , 3) ;
add_filter ('bbp_is_topic_merge' , 'rew_is_topic_merge' ) ;

function rew_get_topic_merge_link( $args = array() ) {

		// Parse arguments against default values
		$r = bbp_parse_args( $args, array(
			'id'           => 0,
			'link_before'  => '',
			'link_after'   => '',
			'merge_text'   => esc_html__( 'Merge', 'bbpress' ),
		), 'get_topic_merge_link' );

		// Get topic
		$topic = bbp_get_topic( $r['id'] );

		// Bail if no topic or current user cannot moderate
		if ( empty( $topic ) || ! current_user_can( 'moderate', $topic->ID ) ) {
			return;
		}

		$uri    = add_query_arg( array( 'action' => 'bbp-merge-topic' ), bbp_get_topic_edit_url( $topic->ID ) );
		$retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-merge-link">' . $r['merge_text'] . '</a>' . $r['link_after'];

		// Filter & return
		return apply_filters( 'rew_get_topic_merge_link', $retval, $r, $args );
	}

function rew_is_topic_merge() {

	// Assume false
	$retval = false;

	// Check topic edit and GET params
	if ( bbp_is_topic_edit() && ! empty( $_GET['action'] ) && ( 'bbp-merge-topic' === $_GET['action'] ) ) {
		return true;
	}

	// Filter & return
	return (bool) apply_filters( 'rew_is_topic_merge', $retval );
}
Skip to toolbar