Skip to:
Content
Pages
Categories
Search
Top
Bottom

Subscriptions to topics are deleted


  • andrewshu
    Participant

    @andrewshu

    Hi,

    I found the issue with the topics subscription.
    How to reproduce this issue:
    1. Subscribe to the topic.
    2. Go to the topic editing in the admin area and update it.
    3. Check the subscription – the subscription is deleted.

    Has anyone encountered this? I tested this issue on 2 installations.

    Regards.

Viewing 8 replies - 1 through 8 (of 8 total)

  • Robin W
    Moderator

    @robin-w

    I cannot immediately replicate this.

    what exactly are you doing at step 2?


    andrewshu
    Participant

    @andrewshu

    Hi @robin-w

    I go to the admin area -> “topics” -> “All topics” -> choose the topic for editing -> Press the “Update” button. After that, the subscription is gone. I change nothing, just press the update button.

    Regards.


    Robin W
    Moderator

    @robin-w

    ok, just tried that, I cannot replicate this on my test site

    so I created a topic by ‘fred’ a participant and logged out.
    I then logged in as an admin, and subscribed to the topic in the front end
    I then went to dashboard>topics>all topics>edit that topic and just clicked update
    I was still subscribed to the topic


    andrewshu
    Participant

    @andrewshu

    Hi @robin-w

    I have only one active plugin – bbPress.
    Please see my screencast – https://jam.dev/c/62cd5543-8fc6-43d6-8a9e-eeeac388594a
    Try checking the subscription is not from the admin.

    Regards.


    Robin W
    Moderator

    @robin-w

    I am not doubting you, but I cannot replicate, so not much more I can do


    andrewshu
    Participant

    @andrewshu

    Hi @robin-w

    I did some more research and found this:
    User 1 (role subscriber + participant) -> create “Topic 1” and subscribe (author of “Topic 1” and is subscribed on it)
    User 2(role subscriber + participant) -> subscribe on “Topic 1” (just a subscribed on “Topic 1”)
    Admin(role administrator + keymaster) -> edit topic through wp-admin dashboard.
    After editing the topic – there is only User 2 in topic subscribers. The author of the topic is unsubscribed.

    Please check these conditions.

    Regards.


    andrewshu
    Participant

    @andrewshu

    Hi @robin-w

    Can you give feedback on my last message?

    Regards.


    Robin W
    Moderator

    @robin-w

    Thanks, I’ve just tested your scenario above, and yes that is a bug.

    I am not a bbpress author, just someone who helps out here.

    Strangely that metabox doesn’t actually let you change the subscribers, it simply lists them, not sure why 🙂

    if you are using

    bbp style pack


    then I’ve included a fix for this in version 5.7.8.

    You can also add comprehensive subscription management functionality for the backend from the ‘subscriptions management’ tab.

    Otherwise you could add this code:

    
    add_action ('bbp_subscriptions_metabox' , 'rew_set_hidden_subscribers' ) ;
    add_action ('bbp_topic_attributes_metabox_save' , 'rew_save_subscriptions', 10 , 2) ;
    
    function rew_set_hidden_subscribers ($post) {
    	// Get user IDs
    	$user_ids = bbp_get_subscribers( $post->ID );
    	$list = implode(",",$user_ids); 
    
    	// Output
    	?>
    	<input name="rew_topic_subscription" id="rew_topic_subscription" type="hidden" value="<?php echo $list; ?>" />
    	<?php
    }
    
    function rew_save_subscriptions ( $topic_id, $forum_id ) {
    	// Handle Subscriptions
    	if ( bbp_is_subscriptions_active() && ! empty( $_POST['rew_topic_subscription'] )) {
    		//update_option ($subscriptions)
    		$subscriptions = explode(",", $_POST['rew_topic_subscription']);
    		foreach ($subscriptions as $subscription_id ) {
    			// Check if subscribed and if so do nothing
    			if (bbp_is_user_subscribed( $subscription_id, $topic_id )) continue;
    			else {
    			bbp_add_user_subscription( $subscription_id, $topic_id );
    			}
    		}
    	}
    }

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

    where %your-theme-name% is the name of your theme

    or use

    Code Snippets

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