Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • in reply to: What plugin are you using to show ticket status? #20560
     triffy
    Participant

    thank you, i found the mistakes myself.

    the error emerge from additional “/” and spaces.
    This version works for me:

    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] ';
    	} 
    	// Let's not override the default statuses
    	elseif(!in_array($status_id, $statuses)) {
    
    		if($replies >= 1) {
    
    			echo '<span class="bbpress-label in-progress">In Progress</span>';
    
    		} else {
    
    			echo '<span class="bbpress-label not-resolved">Not Resolved</span>';
    
    		}
    	// Default Statuses
    	} else {
    
    		if ($status_id == 1) // Not Resolved
    			echo '<span class="bbpress-label not-resolved">Not Resolved</span>';
    
    		if ($status_id == 2) // Not Resolved
    			echo '<span class="bbpress-label resolved">Resolved</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">Resolved</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">Not Resolved</span>';
    		}
    			
    		if ($status_id == 2) {
    			echo '<span class="resolved">Resolved</span>';
    		}
    
    		if ($status_id == 3) {
    			echo '<span class="in-progress">In Progress</span>';
    		}
    
    	} elseif(bbp_is_topic_closed()) {
    
    		echo '<span class="sticky">Sticky</span>';
    		
    	} else {
    
    		echo '<span class="in-progress">In Progress</span>';
    		
    	}
    
    	echo '</div>';
    
    }
    
    in reply to: What plugin are you using to show ticket status? #20397
     triffy
    Participant

    Seems like there is some error in the php:

    instead of

    COPY CODE
    <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" />

    it should say

    COPY CODE
    <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" />
    
    so the correct code here might be
    

    <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

    }
    }
    }`

    but then it still drops me an error on line 147. unexpected $end.

Viewing 2 posts - 1 through 2 (of 2 total)

Log in with your credentials

Forgot your details?