Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
  • in reply to: What plugin are you using to show ticket status? #49694
     RivadeMey
    Participant

    Hi,

    I have one more problem with the plugin. I have implement the code and it is all working fine, but the only problem i have is that i only have 1 forum selected as a support forum, but the labels are showing on all the topics. Even on the topics in other forums (which are not support forums)

    Is there a solution for this?

    I have implemented the code of @sharmstr (thanks!)

    COPY CODE
    //Let’s not override default if its not a support forum
    if (!bbps_is_support_forum(bbp_get_forum_id())){
    //echo ‘<span> its a support fourm </span>';
    }

    but then in the latest topics overview the labels are gone, only visible in the forum itself.

    For the people who are interested, this is the complete code i have used:

    COPY CODE
    
    /** 
     * Modify status display in single topic
     * -------------------------------------------------------------------------------------------*/
    remove_action('bbp_template_before_single_topic', 'bbps_add_support_forum_features');
    add_action('bbp_template_before_single_topic', 'aq_add_support_forum_features');
    
    function aq_add_support_forum_features(){	
    	//only display all this stuff if the support forum option has been selected.
    	if (bbps_is_support_forum(bbp_get_forum_id())){
    		$can_edit = bbps_get_update_capabilities();
    		$topic_id = bbp_get_topic_id();
    		$status = bbps_get_topic_status($topic_id);
    		$forum_id = bbp_get_forum_id();
    		$user_id = get_current_user_id();
    
    		//get out the option to tell us who is allowed to view and update the drop down list.
    		if ( $can_edit == true ) { ?>
    
    		<div id="bbps_support_forum_options">
    			<?php bbps_generate_status_options($topic_id,$status); ?>
    		</div>
    
    		<?php 
    		}
    
    		//has the user enabled the move topic feature?
    		if( (get_option('_bbps_enable_topic_move') == 1) && (current_user_can('administrator') || current_user_can('bbp_moderator')) ) { 
    		?>
    
    		<div id ="bbps_support_forum_move">
    			<form id="bbps-topic-move" name="bbps_support_topic_move" action="" method="post">
    				<label for="bbp_forum_id">Move topic to: </label><?php bbp_dropdown(); ?>
    				<input type="submit" value="Move" name="bbps_topic_move_submit" class="btn btn-default" />
    				<input type="hidden" value="bbps_move_topic" name="bbps_action"/>
    				<input type="hidden" value="<?php echo $topic_id ?>" name="bbps_topic_id" />
    				<input type="hidden" value="<?php echo $forum_id ?>" name="bbp_old_forum_id" />
    			</form>
    		</div>
    
    		<?php
    			
    		}
    	}
    }
    
    /** 
     * Adds Status to topic title
     * -------------------------------------------------------------------------------------------*/
    remove_action('bbp_theme_before_topic_title', 'bbps_modify_title');
    add_action('bbp_theme_before_topic_title', 'aq_modify_before_title', 10, 2);
    function aq_modify_before_title($title, $topic_id = 0) {
    	$topic_id = bbp_get_topic_id( $topic_id );
    
    	$replies = bbp_get_topic_reply_count($topic_id);
    	$statuses = array (1,2,3);
    	$status_id = get_post_meta( $topic_id, '_bbps_topic_status', true );
    
    	// Let's not override default closed/sticky status
    	if(bbp_is_topic_sticky()) {
    		//echo '<span class="topic-sticky"> [Sticky] </span>';
    	} 
    	//Let’s not override default if its not a support forum
    	if (!bbps_is_support_forum(bbp_get_forum_id())){
    		//echo ‘<span> its a support forum </span>';
    	}
    	// Let's not override the default statuses
    	elseif(!in_array($status_id, $statuses)) {
    
    		if($replies >= 1) {
    
    			echo '<span class="bbpress-label in-progress">In Behandeling</span>';
    
    		} else {
    
    			echo '<span class="bbpress-label not-resolved">Nog niet opgelost</span>';
    
    		}
    	// Default Statuses
    	} else {
    
    		if ($status_id == 1) // Not Resolved
    			echo '<span class="bbpress-label not-resolved">Nog niet opgelost</span>';
    
    		if ($status_id == 2) // Not Resolved
    			echo '<span class="bbpress-label resolved">Opgelost</span>';
    
    		if ($status_id == 3) { // Not Support Question (mark as resolved)
    			add_post_meta($topic_id, '_bbps_topic_status', 2);
    			echo '<span class="bbpress-label resolved">Opgelost</span>';
    		}
    	}
    		
    }
    
    /** 
     * Display Topic Status
     * -------------------------------------------------------------------------------------------*/
    function aq_display_topic_status($topic_id = 0) {
    
    	$topic_id = $topic_id ? $topic_id : bbp_get_topic_id();
    
    	$statuses = array (1,2,3);
    	$status_id = get_post_meta( $topic_id, '_bbps_topic_status', true );
    
    	echo '<div class="aq-topic-status">';
    
    	if(bbp_is_topic_sticky()) {
    
    		echo '<span class="sticky">Sticky</span>';
    
    	} elseif(in_array($status_id, $statuses)) {
    
    		if ($status_id == 1) {
    			echo '<span class="not-resolved">Nog niet Opgelost</span>';
    		}
    			
    		if ($status_id == 2) {
    			echo '<span class="resolved">Opgelost</span>';
    		}
    
    		if ($status_id == 3) {
    			echo '<span class="in-progress">In Behandeling</span>';
    		}
    
    	} elseif(bbp_is_topic_closed()) {
    
    		echo '<span class="sticky">Sticky</span>';
    		
    	} else {
    
    		echo '<span class="in-progress">In Behandeling</span>';
    		
    	}
    
    	echo '</div>';
    
    }
    
Viewing 1 post (of 1 total)

Log in with your credentials

Forgot your details?