Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Checkbox for "Keep a log of this edit"

@robin-w

Moderator

ok, undo that previous change by deleting that file, it was rubbish !

Then in your function file add

function default_reply_subscribed() {

		// Get _POST data  IE is this a first post of a topic?
		if ( bbp_is_post_request() && isset( $_POST['bbp_topic_subscription'] ) ) {
			$topic_subscribed = (bool) $_POST['bbp_topic_subscription'];

		// Get edit data  IE either the author or someone else is editing a topic or reply
		} elseif ( bbp_is_topic_edit() || bbp_is_reply_edit() ) {

			// Get current posts author
			$post_author = bbp_get_global_post_field( 'post_author', 'raw' );

			// Post author is not the current user EG a moderator is altering this. In this case we'll leave the default to blank, 
			//as much of the time mods are correcting or moderating, their not interested in the topic itself !
			if ( bbp_get_current_user_id() !== $post_author ) {
				$topic_subscribed = bbp_is_user_subscribed_to_topic( $post_author );

			// Post author is the current user  IE you're editing your own post, so default should be to see any replies
			} else {
				$topic_subscribed = true ;
				//the next line is what it used to say instead of true
				//bbp_is_user_subscribed_to_topic( bbp_get_current_user_id() );
			}

		// Get current status
		} elseif ( bbp_is_single_topic() ) {
			//the user is writing a new reply ?
			$topic_subscribed = true ;
			//the next line is what it used to say instead of true
			//bbp_is_user_subscribed_to_topic( bbp_get_current_user_id() );

		// No data
		} else {
			$topic_subscribed = true;
			//used to say false !
		}

		// Get checked output
		$checked = checked( $topic_subscribed, true, false );

		return apply_filters( 'default_reply_subscribed', $checked, $topic_subscribed );
	}
	
add_filter ('bbp_get_form_topic_subscribed', 'default_reply_subscribed') ;

function default_log_edit_false() {

		// Get _POST data
		if ( bbp_is_post_request() && isset( $_POST['bbp_log_reply_edit'] ) ) {
			$reply_revision = $_POST['bbp_log_reply_edit'];

		// No data
		} else {
			$reply_revision = 0;
		}

		return apply_filters( 'default_log_edit_false', checked( $reply_revision, true, false ) );
	}

add_filter ('bbp_get_form_reply_log_edit', 'default_log_edit_false' ) ;

Functions files and child themes – explained !

that should do both topic edit and reply subscribed.

Skip to toolbar