Skip to:
Content
Pages
Categories
Search
Top
Bottom

Custom Topic Statuses?


  • jlushene
    Participant

    @jlushene

    Is there a way to set custom topic statuses. IE: Being Reviewed, Adopted, Not Adopted, etc. I was able to do this with Buddy Press Support plugin but that does not work with BB Press 2.6.

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

  • Robin W
    Moderator

    @robin-w

    bbpress does not do custom topic statuses, so they are coming from that support plugin, best post there as it is that plugin that needs to work with 2.6, but most plugin authors do not code for pre-release software as it changes.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    This will be easier to do in bbPress 2.6. A bunch of hooks were added to the codebase to make status manipulation possible in many ways it was not previously.


    krioteh
    Participant

    @krioteh

    Buddy-bbPress Support The topic still works with bbPress 2.6, albeit with errors.
    You can return the form to the console settings of a specific forum using this code:

    
    add_action('add_meta_boxes', 'bbbp_support'); 
    add_action('save_post', 'bbbp_save'); 
    
    function bbbp_support() {
    	add_meta_box('bbbp_support', 'BbbPress Support', 
    	'bbbp_support_callback', 'forum'); 
    }
    // HTML код блока
    function bbbp_support_callback( $forum = falce ){
    		if ( empty( $forum->ID ) ) {
    			return;
    		}
    
    		$support_feature = bpbbpst_get_forum_support_setting( $forum->ID );
    
    		$mailing_list_style = '';
    		if ( 3 === (int) $support_feature ) {
    			$mailing_list_style = 'style="display:none"';
    		}
    
    		$support_only_style = 'style="display:none"';
    
    		if ( 2 === (int) $support_feature ) {
    			$support_only_style = '';
    		}
    
    		bpbbpst_display_forum_setting_options( $support_feature );
    		?>
    		<div class="bpbbpst-mailing-list" <?php echo $mailing_list_style;?>>
    			<h4><?php _e( 'Who should receive an email notification when a new support topic is posted ?', 'buddy-bbpress-support-topic' );?></h4>
    
    			<?php bpbbpst_checklist_moderators( $forum->ID );?>
    		</div>
    
    		<?php do_action_ref_array( 'bpbbpst_forum_support_options', array( $forum->ID, $mailing_list_style ) ); ?>
    
    		<div class="bpbbpst-support-guides" <?php echo $support_only_style;?>>
    			<h4><?php _e( 'New Topic form extras', 'buddy-bbpress-support-topic' );?></h4>
    			<label class="screen-reader-text" for="support-topic-intro"><?php esc_html_e( 'New Topic Guide', 'buddy-bbpress-support-topic' ); ?></label>
    			<textarea rows="3" cols="40" name="_bpbbpst_support_topic[intro]" id="support-topic-intro" style="width:100%"><?php echo bpbbpst_get_forum_support_topic_intro( $forum->ID );?></textarea>
    			<p class="description"><?php printf( esc_html__( 'Use this field to insert some instructions above the new topic form. Allowed tags are: %s', 'buddy-bbpress-support-topic' ), join( ', ', array_keys( (array) wp_kses_allowed_html( 'forum' ) ) ) ); ?></p>
    
    			<label class="screen-reader-text" for="support-topic-tpl"><?php esc_html_e( 'New Topic Template', 'buddy-bbpress-support-topic' ); ?></label>
    			<textarea rows="3" cols="40" name="_bpbbpst_support_topic[tpl]" id="support-topic-tpl" style="width:100%"><?php echo bpbbpst_get_forum_support_topic_template( $forum->ID );?></textarea>
    			<p class="description"><?php esc_html_e( 'The text added within this field will be used as a template for the content of new topics.', 'buddy-bbpress-support-topic' ); ?></p>
    		</div>
    		<?php
    
    		do_action_ref_array( 'bpbbpst_forum_support_options_after_guides', array( $forum->ID, $support_only_style ) );
    	}
    	function bbbp_save( $forum_id = 0 ) {
    		$support_feature   = false;
    		$is_forum_category =  bbp_is_forum_category( $forum_id );
    
    		if ( ! empty( $_POST['_bpbbpst_forum_settings'] ) ) {
    			$support_feature = absint( $_POST['_bpbbpst_forum_settings'] );
    		}
    
    		// Forum is not a category, save the support metas
    		if ( ! empty( $support_feature ) && ! $is_forum_category ) {
    			update_post_meta( $forum_id, '_bpbbpst_forum_settings', $support_feature );
    
    			if ( 3 === (int) $support_feature ) {
    				delete_post_meta( $forum_id, '_bpbbpst_support_recipients' );
    				delete_post_meta( $forum_id, '_bpbbpst_support_topic_intro' );
    				delete_post_meta( $forum_id, '_bpbbpst_support_topic_tpl' );
    			} else {
    				$recipients = ! empty( $_POST['_bpbbpst_support_recipients'] ) ? array_map( 'intval', $_POST['_bpbbpst_support_recipients'] ) : false ;
    
    				if ( ! empty( $recipients ) && is_array( $recipients ) && count( $recipients ) > 0 ) {
    					update_post_meta( $forum_id, '_bpbbpst_support_recipients', $recipients );
    				} else {
    					delete_post_meta( $forum_id, '_bpbbpst_support_recipients' );
    				}
    
    				if ( 2 === (int) $support_feature ) {
    					if ( ! empty( $_POST['_bpbbpst_support_topic']['intro'] ) ) {
    						update_post_meta( $forum_id, '_bpbbpst_support_topic_intro', wp_unslash( $_POST['_bpbbpst_support_topic']['intro'] ) );
    					} else {
    						delete_post_meta( $forum_id, '_bpbbpst_support_topic_intro' );
    					}
    
    					if ( ! empty( $_POST['_bpbbpst_support_topic']['tpl'] ) ) {
    						update_post_meta( $forum_id, '_bpbbpst_support_topic_tpl', wp_unslash( $_POST['_bpbbpst_support_topic']['tpl'] ) );
    					} else {
    						delete_post_meta( $forum_id, '_bpbbpst_support_topic_tpl' );
    					}
    				} else if ( ! empty( $_POST['_bpbbpst_support_topic'] ) ) {
    					delete_post_meta( $forum_id, '_bpbbpst_support_topic_intro' );
    					delete_post_meta( $forum_id, '_bpbbpst_support_topic_tpl' );
    				}
    			}
    
    			do_action( 'bpbbpst_forum_settings_updated', $forum_id, $support_feature );
    
    		// Check for support metas to eventually remove them
    		} else if ( $is_forum_category ) {
    			$support_feature = get_post_meta( $forum_id, '_bpbbpst_forum_settings', true );
    
    			if ( ! empty( $support_feature ) ) {
    				delete_post_meta( $forum_id, '_bpbbpst_forum_settings' );
    				delete_post_meta( $forum_id, '_bpbbpst_support_recipients' );
    				delete_post_meta( $forum_id, '_bpbbpst_support_topic_intro' );
    				delete_post_meta( $forum_id, '_bpbbpst_support_topic_tpl' );
    			}
    		}
    
    		return $forum_id;
    	}
    

    Unfortunately, I have not yet found a way to eliminate errors when editing themes in the console: (


    krioteh
    Participant

    @krioteh

    By the way, there is also a bbResolutions plugin – it also works with bPress 2.6


    krioteh
    Participant

    @krioteh

    I’m forked Buddy-bbPress Support Topic in GitHub, now it works with 2.6.
    True, I do not fully understand what I did 🙂

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