Skip to:
Content

bbPress.org

Opened 5 years ago

Last modified 13 months ago

#3362 accepted defect (bug)

Admin area updates delete subscriptions on posts.

Reported by: wpturk's profile wpturk Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: Under Consideration Priority: highest omg sweet tea
Severity: major Version:
Component: General - Administration Keywords:
Cc:

Description

I am running the latest 2.6.4 and discovered problem regarding subscriptions:

This is before updating topic (post_id:60483) in admin area:

mysql> select * from forum_postmeta where meta_key="_bbp_subscription" and post_id="60483" ;
+---------+---------+-------------------+------------+
| meta_id | post_id | meta_key          | meta_value |
+---------+---------+-------------------+------------+
|   61987 |   60483 | _bbp_subscription | 4811       |
+---------+---------+-------------------+------------+
1 row in set (0.00 sec)

This is after updating the topic (post_id:60483) in admin area:

mysql> select * from forum_postmeta where meta_key="_bbp_subscription" and post_id="60483" ;
Empty set (0.00 sec)

The subscription is DELETED after admin changes something and updates a post.

Change History (5)

#1 @wpturk
5 years ago

Ok it took me a few hours but I found what is deleting the subscription:

Line 811 in bbpress/includes/topics/functions.php (if I comment this line it works fine)

                // Check if subscribed
                $subscribed = bbp_is_user_subscribed( $author_id, $topic_id );

                // Check for action
                $subscheck  = ( ! empty( $_POST['bbp_topic_subscription'] ) && ( 'bbp_subscribe' === $_POST['bbp_topic_subscription'] ) )
                        ? true
                        : false;

                // Subscribed and unsubscribing
                if ( ( true === $subscribed ) && ( false === $subscheck ) ) {
                        bbp_remove_user_subscription( $author_id, $topic_id );

During backend update there will be no checkbox selected and $subscheck is false and bbp_remove_user_subscription is executed. This explains also why only author subscription is deleted not other subscribers.

#2 @wpturk
5 years ago

the same issue for replies: bbpress/includes/replies/functions.php

#3 @johnjamesjacoby
4 years ago

  • Component changed from General to General - Administration
  • Milestone changed from Awaiting Review to 2.6.7
  • Owner set to johnjamesjacoby
  • Status changed from new to accepted

#4 @johnjamesjacoby
4 years ago

  • Milestone changed from 2.6.7 to Under Consideration

Hey @wpturk, sorry for the delay in looking into this.

Unfortunately, I'm unable to replicate this under normal conditions, and I could use a bit more information from you. Is it possible to detail exactly what steps need to be taken to force this to happen?

I've swapped between two Keymaster users, subscribed to two separate topics, and editing either topic from within WordPress Admin does not remove subscriptions from either, regardless of the user and their subscription status.

I was able to force it by de-registering the bbp_topic_subscriptions_metabox meta-box and then editing a topic I was subscribed to. That forces it because the "bbp_topic_subscription" input ends up not being output, failing the subcheck but passing as subscribed. This behavior is unintended, but definitely an edge-case. It's worth fixing, but likely not in a minor release.

Any ideas or help you can offer is welcome and greatly appreciated. 🙏

#5 @wpturk
4 years ago

Hi John,

Thanks looking on this.

I swapped to the default wp theme and deactivated plugins, the same problem occurs there too. The topic author subscription gets deleted on post saving in backend.

When I print all $POST variables on save_post hook, bbp_topic_subscription returns empty.

<?php
...
    [_thumbnail_id] => -1
    [page] => 0
    [paged] => 1
    [bbp_topic_subscription] => 
    [post_name] => paypal-devri-turkiyede-kapaniyor-mu
    [icl_make_translatable] => topic,0
    [_icl_nonce_imi] => 3658332707
    [post_mime_type] => 
    [ID] => 283
...

Sorry, I have no idea why bbp_topic_subscriptions_metabox is not delivering the subscriptions.

Note: See TracTickets for help on using tickets.