Skip to:
Content
Pages
Categories
Search
Top
Bottom

Checkbox for "Keep a log of this edit"


  • David13_13
    Participant

    @david13_13

    Hello to all

    The checkbox for “Keep a log of this edit” is marked by default. Is there a way to have it unchecked by default?

    Thanks a lot!

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

  • Robin W
    Moderator

    @robin-w

    can you just say where you see this?


    David13_13
    Participant

    @david13_13

    Yes, when I click in edit a topic


    Robin W
    Moderator

    @robin-w

    frontend or backend?


    David13_13
    Participant

    @david13_13

    Frontend, every suscriber sees that when he tries to edit the post


    Robin W
    Moderator

    @robin-w

    ok thanks I can see it now.

    create a directory on your theme called ‘bbpress’
    ie wp-content/themes/%your-theme-name%/bbpress

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

    find
    wp-content/plugins/bbpress/templates/default/bbpress/form-topic.php
    Make a copy of this file, and put in in the directory called bbpress that you created above, so you end up with
    wp-content/themes/%your-theme-name%/bbpress/form-topic.php
    bbPress will now use this template instead of the original

    then edit this file to change line 183

    <input name="bbp_log_topic_edit" id="bbp_log_topic_edit" type="checkbox" value="1" 
    

    etc.

    to

    <input name="bbp_log_topic_edit" id="bbp_log_topic_edit" type="checkbox" value="0" 
    

    etc.

    It will then be unchecked by default


    David13_13
    Participant

    @david13_13

    Thanks a lot my friend!

    And I guess that there is another option like this to activate by default the checkbox for suscribe to new replies when you are writing an answer in a topic or creating a new one, isn’t? “Notify me of follow-up replies via email”

    Could you say me where can I found it?

    Thanks in advance for all the help


    David13_13
    Participant

    @david13_13

    I have changed this code too:

    `<input name=”bbp_log_reply_edit” id=”bbp_log_reply_edit” type=”checkbox” value=”0″ <?php bbp_form_reply_log_edit(); ?> tabindex=”<?php bbp_tab_index(); ?>” />

    in the form-reply.php, but the checkbox is still checked by default


    Robin W
    Moderator

    @robin-w

    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.


    David13_13
    Participant

    @david13_13

    It works fine now!

    Thank you a lot!!! 🙂


    Robin W
    Moderator

    @robin-w

    Great – glad you’re fixed !


    David13_13
    Participant

    @david13_13

    Hello again.

    I just installed a new website and the latest version of WordPress and BBpress and the last code that worked well in that website is no working here. The email notification works well, but still is checked the log field…

    Any suggestion please?

    I guess that the code of BBpress has changed in recent versions…

    Thanks in advance


    David13_13
    Participant

    @david13_13

    Oh, wait a moment, it works well for replies but not for new topics


    Robkk
    Moderator

    @robkk

    @david13_13

    There are probably a bunch of alternatives, but this works for both topics and replies.

    https://wordpress.org/plugins/bbpress-auto-subscribe-for-new-topics-and-replies/

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