Skip to:
Content

bbPress.org

Ticket #3365: 0001-use-same-action-variables-for-GET-POST.patch

File 0001-use-same-action-variables-for-GET-POST.patch, 4.3 KB (added by konnektiv, 4 years ago)

This patch fixes the problem for us for move, split and merge.

  • includes/common/template.php

    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 b function bbp_is_topic_merge() { 
    316316        $retval = false;
    317317
    318318        // Check topic edit and GET params
    319         if ( bbp_is_topic_edit() && ! empty( $_GET['action'] ) && ( 'merge' === $_GET['action'] ) ) {
     319        if ( bbp_is_topic_edit() && ! empty( $_GET['action'] ) && ( 'bbp-merge-topic' === $_GET['action'] ) ) {
    320320                return true;
    321321        }
    322322
    function bbp_is_topic_split() { 
    337337        $retval = false;
    338338
    339339        // Check topic edit and GET params
    340         if ( bbp_is_topic_edit() && ! empty( $_GET['action'] ) && ( 'split' === $_GET['action'] ) ) {
     340        if ( bbp_is_topic_edit() && ! empty( $_GET['action'] ) && ( 'bbp-split-topic' === $_GET['action'] ) ) {
    341341                $retval = true;
    342342        }
    343343
    function bbp_is_reply_move() { 
    499499        $retval = false;
    500500
    501501        // Check reply edit and GET params
    502         if ( bbp_is_reply_edit() && ! empty( $_GET['action'] ) && ( 'move' === $_GET['action'] ) ) {
     502        if ( bbp_is_reply_edit() && ! empty( $_GET['action'] ) && ( 'bbp-move-reply' === $_GET['action'] ) ) {
    503503                $retval = true;
    504504        }
    505505
  • includes/extend/buddypress/groups.php

    diff --git a/includes/extend/buddypress/groups.php b/includes/extend/buddypress/groups.php
    index 0bd7cbc..e4d7910 100644
    a b class BBP_Forums_Group_Extension extends BP_Group_Extension { 
    10761076                                                $bbp->current_topic_id       = get_the_ID();
    10771077
    10781078                                                // Merge
    1079                                                 if ( ! empty( $_GET['action'] ) && 'merge' === $_GET['action'] ) :
     1079                                                if ( ! empty( $_GET['action'] ) && 'bbp-merge-topic' === $_GET['action'] ) :
    10801080                                                        bbp_set_query_name( 'bbp_topic_merge' );
    10811081                                                        bbp_get_template_part( 'form', 'topic-merge' );
    10821082
    10831083                                                // Split
    1084                                                 elseif ( ! empty( $_GET['action'] ) && 'split' === $_GET['action'] ) :
     1084                                                elseif ( ! empty( $_GET['action'] ) && 'bbp-split-topic' === $_GET['action'] ) :
    10851085                                                        bbp_set_query_name( 'bbp_topic_split' );
    10861086                                                        bbp_get_template_part( 'form', 'topic-split' );
    10871087
    class BBP_Forums_Group_Extension extends BP_Group_Extension { 
    11461146                                                $bbp->current_reply_id       = get_the_ID();
    11471147
    11481148                                                // Move
    1149                                                 if ( ! empty( $_GET['action'] ) && ( 'move' === $_GET['action'] ) ) :
     1149                                                if ( ! empty( $_GET['action'] ) && ( 'bbp-move-reply' === $_GET['action'] ) ) :
    11501150                                                        bbp_set_query_name( 'bbp_reply_move' );
    11511151                                                        bbp_get_template_part( 'form', 'reply-move' );
    11521152
  • includes/replies/template.php

    diff --git a/includes/replies/template.php b/includes/replies/template.php
    index 2dc25e1..2732dae 100644
    a b function bbp_reply_move_link( $args = array() ) { 
    20962096                }
    20972097
    20982098                $uri = add_query_arg( array(
    2099                         'action'   => 'move',
     2099                        'action'   => 'bbp-move-reply',
    21002100                        'reply_id' => $reply_id
    21012101                ), bbp_get_reply_edit_url( $reply_id ) );
    21022102
    function bbp_topic_split_link( $args = array() ) { 
    21552155                }
    21562156
    21572157                $uri = add_query_arg( array(
    2158                         'action'   => 'split',
     2158                        'action'   => 'bbp-split-topic',
    21592159                        'reply_id' => $reply_id
    21602160                ), bbp_get_topic_edit_url( $topic_id ) );
    21612161
  • includes/topics/template.php

    diff --git a/includes/topics/template.php b/includes/topics/template.php
    index 76711e9..52b242b 100644
    a b function bbp_topic_merge_link( $args = array() ) { 
    27642764                        return;
    27652765                }
    27662766
    2767                 $uri    = add_query_arg( array( 'action' => 'merge' ), bbp_get_topic_edit_url( $topic->ID ) );
     2767                $uri    = add_query_arg( array( 'action' => 'bbp-merge-topic' ), bbp_get_topic_edit_url( $topic->ID ) );
    27682768                $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-merge-link">' . $r['merge_text'] . '</a>' . $r['link_after'];
    27692769
    27702770                // Filter & return