Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Error: A variable mismatch has been detected.

@robin-w

Moderator

can you try this in your child theme function file or snippets

function rew_get_topic_split_link( $retval, $r, $args ) {

		// Parse arguments against default values
		$r = bbp_parse_args( $args, array(
			'id'          => 0,
			'link_before' => '',
			'link_after'  => '',
			'split_text'  => esc_html__( 'Split',                           'bbpress' ),
			'split_title' => esc_attr__( 'Split the topic from this reply', 'bbpress' )
		), 'get_topic_split_link' );

		// Get IDs
		$reply_id = bbp_get_reply_id( $r['id'] );
		$topic_id = bbp_get_reply_topic_id( $reply_id );

		// Bail if no reply/topic ID, or user cannot moderate
		if ( empty( $reply_id ) || empty( $topic_id ) || ! current_user_can( 'moderate', $topic_id ) ) {
			return;
		}

		$uri = add_query_arg( array(
			'action'   => 'bbp-split-topic',
			'reply_id' => $reply_id
		), bbp_get_topic_edit_url( $topic_id ) );

		$retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" title="' . $r['split_title'] . '" class="bbp-topic-split-link">' . $r['split_text'] . '</a>' . $r['link_after'];

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

add_filter ('bbp_get_topic_split_link', 'rew_get_topic_split_link' , 10 , 3) ;

function rew_is_topic_split() {

	// Assume false
	$retval = false;

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

	// Filter & return
	return (bool) apply_filters( 'rew_is_topic_split', $retval );
}

add_filter ('bbp_is_topic_split' , 'rew_is_topic_split' ) ;
Skip to toolbar