From 62a0ba89c37c52e68715f8c6733f16e985ef1ae6 Mon Sep 17 00:00:00 2001
From: Christoph Herbst <chris.p.herbst@gmail.com>
Date: Tue, 12 Jan 2021 12:46:55 +0100
Subject: [PATCH] use same action variables for GET & POST

this affects move, split & merge

This fixes: https://bbpress.trac.wordpress.org/ticket/3365
---
 includes/common/template.php          | 6 +++---
 includes/extend/buddypress/groups.php | 6 +++---
 includes/replies/template.php         | 4 ++--
 includes/topics/template.php          | 2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/includes/common/template.php b/includes/common/template.php
index 83fa820..d9a77d6 100644
--- a/includes/common/template.php
+++ b/includes/common/template.php
@@ -316,7 +316,7 @@ function bbp_is_topic_merge() {
 	$retval = false;
 
 	// Check topic edit and GET params
-	if ( bbp_is_topic_edit() && ! empty( $_GET['action'] ) && ( 'merge' === $_GET['action'] ) ) {
+	if ( bbp_is_topic_edit() && ! empty( $_GET['action'] ) && ( 'bbp-merge-topic' === $_GET['action'] ) ) {
 		return true;
 	}
 
@@ -337,7 +337,7 @@ function bbp_is_topic_split() {
 	$retval = false;
 
 	// Check topic edit and GET params
-	if ( bbp_is_topic_edit() && ! empty( $_GET['action'] ) && ( 'split' === $_GET['action'] ) ) {
+	if ( bbp_is_topic_edit() && ! empty( $_GET['action'] ) && ( 'bbp-split-topic' === $_GET['action'] ) ) {
 		$retval = true;
 	}
 
@@ -499,7 +499,7 @@ function bbp_is_reply_move() {
 	$retval = false;
 
 	// Check reply edit and GET params
-	if ( bbp_is_reply_edit() && ! empty( $_GET['action'] ) && ( 'move' === $_GET['action'] ) ) {
+	if ( bbp_is_reply_edit() && ! empty( $_GET['action'] ) && ( 'bbp-move-reply' === $_GET['action'] ) ) {
 		$retval = true;
 	}
 
diff --git a/includes/extend/buddypress/groups.php b/includes/extend/buddypress/groups.php
index 0bd7cbc..e4d7910 100644
--- a/includes/extend/buddypress/groups.php
+++ b/includes/extend/buddypress/groups.php
@@ -1076,12 +1076,12 @@ class BBP_Forums_Group_Extension extends BP_Group_Extension {
 						$bbp->current_topic_id       = get_the_ID();
 
 						// Merge
-						if ( ! empty( $_GET['action'] ) && 'merge' === $_GET['action'] ) :
+						if ( ! empty( $_GET['action'] ) && 'bbp-merge-topic' === $_GET['action'] ) :
 							bbp_set_query_name( 'bbp_topic_merge' );
 							bbp_get_template_part( 'form', 'topic-merge' );
 
 						// Split
-						elseif ( ! empty( $_GET['action'] ) && 'split' === $_GET['action'] ) :
+						elseif ( ! empty( $_GET['action'] ) && 'bbp-split-topic' === $_GET['action'] ) :
 							bbp_set_query_name( 'bbp_topic_split' );
 							bbp_get_template_part( 'form', 'topic-split' );
 
@@ -1146,7 +1146,7 @@ class BBP_Forums_Group_Extension extends BP_Group_Extension {
 						$bbp->current_reply_id       = get_the_ID();
 
 						// Move
-						if ( ! empty( $_GET['action'] ) && ( 'move' === $_GET['action'] ) ) :
+						if ( ! empty( $_GET['action'] ) && ( 'bbp-move-reply' === $_GET['action'] ) ) :
 							bbp_set_query_name( 'bbp_reply_move' );
 							bbp_get_template_part( 'form', 'reply-move' );
 
diff --git a/includes/replies/template.php b/includes/replies/template.php
index 2dc25e1..2732dae 100644
--- a/includes/replies/template.php
+++ b/includes/replies/template.php
@@ -2096,7 +2096,7 @@ function bbp_reply_move_link( $args = array() ) {
 		}
 
 		$uri = add_query_arg( array(
-			'action'   => 'move',
+			'action'   => 'bbp-move-reply',
 			'reply_id' => $reply_id
 		), bbp_get_reply_edit_url( $reply_id ) );
 
@@ -2155,7 +2155,7 @@ function bbp_topic_split_link( $args = array() ) {
 		}
 
 		$uri = add_query_arg( array(
-			'action'   => 'split',
+			'action'   => 'bbp-split-topic',
 			'reply_id' => $reply_id
 		), bbp_get_topic_edit_url( $topic_id ) );
 
diff --git a/includes/topics/template.php b/includes/topics/template.php
index 76711e9..52b242b 100644
--- a/includes/topics/template.php
+++ b/includes/topics/template.php
@@ -2764,7 +2764,7 @@ function bbp_topic_merge_link( $args = array() ) {
 			return;
 		}
 
-		$uri    = add_query_arg( array( 'action' => 'merge' ), bbp_get_topic_edit_url( $topic->ID ) );
+		$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
-- 
2.25.1

