Skip to:
Content
Pages
Categories
Search
Top
Bottom

Moving a reply to a new topic

  • @ajtruckle

    Participant

    I am trying to move a reply into a new topic. Ideally I would be able to move it to a different forum board altogether but for now I am just trying to move the reply out into a new thread.

    When I hit move I get this error:

    A variable mismatch has been detected.

    I am using 2.6.1

Viewing 25 replies - 26 through 50 (of 50 total)
  • @robin-w

    Moderator

    ok, I can only suggest that you revert to the standard tests

    Themes

    As a test switch to a default theme such as twentyfifteen, and see if this fixes.

    Plugins

    If that doesn’t work, also deactivate all plugins apart from bbpress and see if this fixes. if it does, re-enable one at a time to see which is causing the error.

    Then come back

    @finallyfoundausernamenotusedbefore

    Participant

    Chuckie, did you find a solution?

    I read on the linked thread that reverting to PHP7.1 (I was previously on 7.3) would fix it, but it doesn’t for me.

    My combination is now WP v5.4 and PHP 7.1.

    John

    @robin-w

    Moderator

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

    Code 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' ) ;

    and come back and confirm that it works

    @finallyfoundausernamenotusedbefore

    Participant

    Thanks for the quick response, Robin.

    I am afraid I still get the same message – “A variable mismatch has been detected.”, with PHP7.1.

    I added this using Code Snippets.

    John

    @robin-w

    Moderator

    what other plugins are you using ?

    @finallyfoundausernamenotusedbefore

    Participant

    Hi Robin,

    Those that relate to BBpress are:
    Advanced noCaptcha & invisible Captcha
    bbP private groups
    bbp style pack
    bbPress Login Register Links On Forum Topic Pages
    bbPress Messages
    bbPress Unread Posts v2
    LoginPress – Customizing the WordPress Login
    WP User Avatar

    I’m sure your next suggestion will be to disable them all, which I am happy to do if necessary, The forum is not publicly visible yet. I was just hopeful the OP may have already found the problem 🙂

    Let me know if that’s the direction you would like me to go.

    Best regards,

    John

    @robin-w

    Moderator

    you guessed right, we might need to do that.

    This was found to happen with Theme my login plugin, which registered a public query which both use. My bug fix should have corrected that, even if another plugin is doing it.

    But yes, we need to find which plugin is doing that.

    however just before we do, can you take out the code above from code snippets

    then in

    dashboard>settings>bbp style pack>bug fixes, can you tick “Fix ‘A variable Mismatch has been detected’ ” save and try again.

    then come back

    @finallyfoundausernamenotusedbefore

    Participant

    Welllllll . . . blow me sideways!

    So embarrassing that I hadn’t dug that deep into the bbpstylepack settings.

    All now working. Thank you VERY much for your time on this.

    Best regards,

    John

    @robin-w

    Moderator

    great – not sure why it didn’t work in code snippets (in essence it’s the same code as you’ve just enabled in style pack), but that will help me – glad you are fixed !!

    @finallyfoundausernamenotusedbefore

    Participant

    I am known to make mistakes! Maybe I did something wrong.

    The bad news is that my super-dooper moderator (who I admit I did ask to test things to death before we open the site to the masses) has now discovered he gets that same error messages when trying to merge topics.

    The fix in BBstylepack is still activated so it seems that isn’t a fix for everything.

    I’m not sure if I should be asking for more help from you as the impression I get is that another plugin is causing a conflict. And looking at your snippet code it looks to me as if that is for splitting topics only. But I thought I should make you aware.

    Meanwhile I will start disabling plugins and see what gives.

    John

    Best regards,

    John

    @finallyfoundausernamenotusedbefore

    Participant

    Hi again, Robin,

    I have found the conflict. It is:
    “Another WordPress Classifieds Plugin (AWPCP)”

    Not for me to criticise or condemn anything – I’m just naming it here in case anybody comes up against the same problem.

    Best regards,

    John

    @robin-w

    Moderator

    no problem in naming – there are thousands of plugins, and there is always the risk that 2 will use similar name and collide.

    I’ll take a look, but maybe a day or 2

    @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 );
    }

    @ajtruckle

    Participant

    Cool. I suppose I don’t need to activate this because I switched off moderation anyway via a snippet.

    @finallyfoundausernamenotusedbefore

    Participant

    Blimey, Robin – you said a couple of days. Time flies!

    Once again a BIIIIIG thank you.

    John

    @robin-w

    Moderator

    found a slot whilst waiting for a client to respond !

    @ajtruckle

    Participant

    Just upgraded to your latest version 4.5.1

    Change log says:

    additional bug fix for merge topics on variable mismatch on bug fixes tab

    But I still only see 3 possible bug fixes listed? Please advise.

    @robin-w

    Moderator

    the variable mismatch fix now does both split and merge

    @ajtruckle

    Participant

    Oh, OK. So to test this out I simply have to try and merge two topics. Is that the idea? Or merge two replies? i did not follow this whole discussion.

    @robin-w

    Moderator

    you can only merge topics in bbpress, so yes merge two topics

    @ajtruckle

    Participant

    OK. The merging test I did worked fine. Thanks.

    Question:

    View post on imgur.com

    Why is my “Merge topic tags” check box in the middle?! Why not on the left?

    @robin-w

    Moderator

    It isn;t on my site, so a css thing with your theme.

    but glad it works, and thanks for testing !!

    @ajtruckle

    Participant

    I find it interesting that even with my new theme (which behaves way better than my previous) that the check box is still central:

    View post on imgur.com

    @ajtruckle

    Participant

    The reason for the issue is because I have this custom CSS that has a side effect on the check box:

    /* Topic Title */
    input#bbp_topic_title, input#bbp_topic_tags {
    	width: 100%;
    }

    This is causing that check box to take on 100% with instead of 13px like the other check boxes. I need to find a way of being able to make my changes above without causing the side effect to the third check box.

    You see, when creating a topic or reply we have a list of tags in a input box and in that context I want 100% width. But when merging topics we are using the same ID for some reason for tags check box and as a result I have a conflict.

    Is there a way to resolve it? Thanks.

    @ajtruckle

    Participant

    Fixed:

    input[type="text"]#bbp_topic_title,
    input[type="text"]#bbp_topic_tags {
    	width: 100%;
    }

    This way I don’t affect the checkbox type controls. Now all OK.

Viewing 25 replies - 26 through 50 (of 50 total)
  • You must be logged in to reply to this topic.
Skip to toolbar