Changeset 7766
- Timestamp:
- 10/02/2026 07:42:39 AM (6 weeks ago)
- Location:
- branches/2.6
- Files:
-
- 1 added
- 6 edited
-
CHANGELOG.md (modified) (1 diff)
-
src/includes/admin/metaboxes.php (modified) (1 diff)
-
src/includes/core/actions.php (modified) (2 diffs)
-
src/includes/replies/functions.php (modified) (1 diff)
-
src/includes/topics/functions.php (modified) (1 diff)
-
src/includes/users/engagements.php (modified) (1 diff)
-
tests/phpunit/testcases/admin/subscriptions.php (added)
Legend:
- Unmodified
- Added
- Removed
-
branches/2.6/CHANGELOG.md
r7750 r7766 13 13 Development for the next bbPress release is in progress. See the active 14 14 [Trac milestones](https://bbpress.trac.wordpress.org/roadmap) for planned work. 15 16 ### Fixed 17 18 - Preserved topic subscriptions when topics and replies are edited in administration. 15 19 16 20 ## 2.6.19 - 2026-09-29 -
branches/2.6/src/includes/admin/metaboxes.php
r7660 r7766 794 794 function bbp_topic_subscriptions_metabox( $post ) { 795 795 796 // Current user subscription797 $input_value = bbp_is_user_subscribed( bbp_get_current_user_id(), $post->ID )798 ? 'bbp_subscribe' // maintain existing subscription799 : ''; // do not add or remove subscription800 801 796 // Get user IDs 802 797 $user_ids = bbp_get_subscribers( $post->ID ); 803 798 804 799 // Output 805 ?> 806 <input name="bbp_topic_subscription" id="bbp_topic_subscription" type="hidden" value="<?php echo esc_attr( $input_value ); ?>" /> 807 <p><?php 800 ?><p><?php 808 801 809 802 // Relationships -
branches/2.6/src/includes/core/actions.php
r7672 r7766 211 211 add_action( 'bbp_new_reply', 'bbp_update_reply', 10, 7 ); 212 212 add_action( 'bbp_edit_reply', 'bbp_update_reply', 10, 7 ); 213 add_action( 'bbp_new_reply', 'bbp_update_reply_subscription', 10, 5 ); 214 add_action( 'bbp_edit_reply', 'bbp_update_reply_subscription', 10, 5 ); 213 215 214 216 // Before Delete/Trash/Untrash Reply … … 226 228 add_action( 'bbp_new_topic', 'bbp_update_topic', 10, 5 ); 227 229 add_action( 'bbp_edit_topic', 'bbp_update_topic', 10, 5 ); 230 add_action( 'bbp_new_topic', 'bbp_update_topic_subscription', 10, 4 ); 231 add_action( 'bbp_edit_topic', 'bbp_update_topic_subscription', 10, 4 ); 228 232 229 233 // Split/Merge Topic -
branches/2.6/src/includes/replies/functions.php
r7728 r7766 871 871 } 872 872 873 // Handle Subscription Checkbox874 if ( bbp_is_subscriptions_active() && ! empty( $author_id ) && ! empty( $topic_id ) ) {875 876 // Check if subscribed877 $subscribed = bbp_is_user_subscribed( $author_id, $topic_id );878 879 // Check for action880 $subscheck = ( ! empty( $_POST['bbp_topic_subscription'] ) && ( 'bbp_subscribe' === $_POST['bbp_topic_subscription'] ) )881 ? true882 : false;883 884 // Subscribed and unsubscribing885 if ( ( true === $subscribed ) && ( false === $subscheck ) ) {886 bbp_remove_user_subscription( $author_id, $topic_id );887 888 // Not subscribed and subscribing889 } elseif ( ( false === $subscribed ) && ( true === $subscheck ) ) {890 bbp_add_user_subscription( $author_id, $topic_id );891 }892 }893 894 873 // Reply meta relating to reply position in tree 895 874 bbp_update_reply_forum_id( $reply_id, $forum_id ); -
branches/2.6/src/includes/topics/functions.php
r7732 r7766 821 821 } 822 822 823 // Handle Subscription Checkbox824 if ( bbp_is_subscriptions_active() && ! empty( $author_id ) ) {825 826 // Check if subscribed827 $subscribed = bbp_is_user_subscribed( $author_id, $topic_id );828 829 // Check for action830 $subscheck = ( ! empty( $_POST['bbp_topic_subscription'] ) && ( 'bbp_subscribe' === $_POST['bbp_topic_subscription'] ) )831 ? true832 : false;833 834 // Subscribed and unsubscribing835 if ( ( true === $subscribed ) && ( false === $subscheck ) ) {836 bbp_remove_user_subscription( $author_id, $topic_id );837 838 // Not subscribed and subscribing839 } elseif ( ( false === $subscribed ) && ( true === $subscheck ) ) {840 bbp_add_user_subscription( $author_id, $topic_id );841 }842 }843 844 823 // Update associated topic values if this is a new topic 845 824 if ( empty( $is_edit ) ) { -
branches/2.6/src/includes/users/engagements.php
r7667 r7766 855 855 856 856 return true; 857 } 858 859 /** 860 * Apply a topic form's subscription choice for its author. 861 * 862 * @since 2.6.20 bbPress (r7766) 863 * 864 * @param int $author_id Topic or reply author ID. 865 * @param int $topic_id Topic ID. 866 */ 867 function bbp_update_user_topic_subscription( $author_id = 0, $topic_id = 0 ) { 868 869 // Bail if subscriptions are disabled or the form has no valid target 870 if ( ! bbp_is_subscriptions_active() || empty( $author_id ) || empty( $topic_id ) ) { 871 return; 872 } 873 874 $subscribed = bbp_is_user_subscribed( $author_id, $topic_id ); 875 $subscheck = ! empty( $_POST['bbp_topic_subscription'] ) && ( 'bbp_subscribe' === $_POST['bbp_topic_subscription'] ); 876 877 if ( $subscribed && ! $subscheck ) { 878 bbp_remove_user_subscription( $author_id, $topic_id ); 879 } elseif ( ! $subscribed && $subscheck ) { 880 bbp_add_user_subscription( $author_id, $topic_id ); 881 } 882 } 883 884 /** 885 * Apply a topic form's subscription choice after saving the topic. 886 * 887 * @since 2.6.20 bbPress (r7766) 888 * 889 * @param int $topic_id Topic ID. 890 * @param int $forum_id Forum ID. 891 * @param array $anonymous_data Anonymous author data. 892 * @param int $author_id Topic author ID. 893 */ 894 function bbp_update_topic_subscription( $topic_id = 0, $forum_id = 0, $anonymous_data = array(), $author_id = 0 ) { 895 bbp_update_user_topic_subscription( $author_id, $topic_id ); 896 } 897 898 /** 899 * Apply a reply form's subscription choice after saving the reply. 900 * 901 * @since 2.6.20 bbPress (r7766) 902 * 903 * @param int $reply_id Reply ID. 904 * @param int $topic_id Topic ID. 905 * @param int $forum_id Forum ID. 906 * @param array $anonymous_data Anonymous author data. 907 * @param int $author_id Reply author ID. 908 */ 909 function bbp_update_reply_subscription( $reply_id = 0, $topic_id = 0, $forum_id = 0, $anonymous_data = array(), $author_id = 0 ) { 910 bbp_update_user_topic_subscription( $author_id, $topic_id ); 857 911 } 858 912
Note:
See TracChangeset
for help on using the changeset viewer.