@@ -956,53 +956,37 @@ public function meta_box_replies() {
956956 }
957957
958958 public function display_ticket_replies () {
959- $ private_replies = SupportFlow ()->get_ticket_replies ( get_the_ID (), array ( 'status ' => 'private ' ) );
959+ $ all_replies = array (
960+ 'private ' => SupportFlow ()->get_ticket_replies ( get_the_ID (), array ( 'status ' => 'private ' ) ),
961+ 'public ' => SupportFlow ()->get_ticket_replies ( get_the_ID (), array ( 'status ' => 'public ' ) ),
962+ );
960963
961- if ( ! empty ( $ private_replies ) ) {
962- echo '<ul class="private-replies"> ' ;
963- foreach ( $ private_replies as $ reply ) {
964- echo '<li> ' ;
965- echo '<div class="ticket-reply"> ' ;
966- $ post_content = wpautop ( stripslashes ( $ reply ->post_content ) );
967- // Make link clickable
968- $ post_content = make_clickable ( $ post_content );
969- $ post_content = $ this ->hide_quoted_text ( $ post_content );
970- echo $ post_content ;
971- if ( $ attachment_ids = get_post_meta ( $ reply ->ID , 'sf_attachments ' ) ) {
972- echo '<ul class="ticket-reply-attachments"> ' ;
973- foreach ( $ attachment_ids as $ attachment_id ) {
974- $ attachment_link = SupportFlow ()->extend ->attachments ->get_attachment_url ( $ attachment_id );
975- echo '<li><a target="_blank" href=" ' . esc_url ( $ attachment_link ) . '"> ' . esc_html ( get_the_title ( $ attachment_id ) ) . '</a></li> ' ;
976- }
977- echo '</ul> ' ;
978- }
979- echo '</div> ' ;
980- $ reply_author = get_post_meta ( $ reply ->ID , 'reply_author ' , true );
981- $ reply_timestamp = sprintf ( __ ( 'Noted by %1$s on %2$s at %3$s ' , 'supportflow ' ), $ reply_author , get_the_date ( '' , $ reply ->ID ), get_the_time ( '' , $ reply ->ID ) );
982- $ modified_gmt = get_post_modified_time ( 'U ' , true , $ reply ->ID );
983- $ last_activity = sprintf ( __ ( '%s ago ' , 'supportflow ' ), human_time_diff ( $ modified_gmt ) );
984- echo '<div class="ticket-meta"><span class="reply-timestamp"> ' . esc_html ( $ reply_timestamp ) . ' ( ' . $ last_activity . ') ' . '</span></div> ' ;
985- echo '</li> ' ;
964+ foreach ( $ all_replies as $ status => $ replies ) {
965+ if ( empty ( $ replies ) ) {
966+ continue ;
986967 }
987- echo '</ul> ' ;
988- }
989968
990- $ replies = SupportFlow ()-> get_ticket_replies ( get_the_ID (), array ( ' status ' => ' public ' ) ) ;
991- if ( ! empty ( $ replies ) ) {
992- echo ' <ul class="ticket-replies"> ' ;
969+ $ class = ' private ' == $ status ? ' private-replies ' : ' ticket-replies ' ;
970+ echo " <ul class=' $ class '> " ;
971+
993972 foreach ( $ replies as $ reply ) {
994- $ reply_author = get_post_meta ( $ reply ->ID , 'reply_author ' , true );
995- $ reply_author_email = get_post_meta ( $ reply ->ID , 'reply_author_email ' , true );
996973 echo '<li> ' ;
997- echo '<div class="reply-avatar"> ' . get_avatar ( $ reply_author_email , 72 );
998- echo '<p class="reply-author"> ' . esc_html ( $ reply_author ) . '</p> ' ;
999- echo '</div> ' ;
974+
975+ if ( 'public ' == $ status ) {
976+ $ reply_author = get_post_meta ( $ reply ->ID , 'reply_author ' , true );
977+ $ reply_author_email = get_post_meta ( $ reply ->ID , 'reply_author_email ' , true );
978+ echo '<div class="reply-avatar"> ' . get_avatar ( $ reply_author_email , 72 );
979+ echo '<p class="reply-author"> ' . esc_html ( $ reply_author ) . '</p> ' ;
980+ echo '</div> ' ;
981+ }
982+
1000983 echo '<div class="ticket-reply"> ' ;
1001984 $ post_content = wpautop ( stripslashes ( $ reply ->post_content ) );
1002985 // Make link clickable
1003986 $ post_content = make_clickable ( $ post_content );
1004987 $ post_content = $ this ->hide_quoted_text ( $ post_content );
1005988 echo $ post_content ;
989+
1006990 if ( $ attachment_ids = get_post_meta ( $ reply ->ID , 'sf_attachments ' ) ) {
1007991 echo '<ul class="ticket-reply-attachments"> ' ;
1008992 foreach ( $ attachment_ids as $ attachment_id ) {
@@ -1012,17 +996,23 @@ public function display_ticket_replies() {
1012996 echo '</ul> ' ;
1013997 }
1014998 echo '</div> ' ;
1015- $ reply_timestamp = sprintf ( __ ( '%s at %s ' , 'supportflow ' ), get_the_date ( '' , $ reply ->ID ), get_the_time ( '' , $ reply ->ID ) );
1016- $ modified_gmt = get_post_modified_time ( 'U ' , true , $ reply ->ID );
1017- $ last_activity = sprintf ( __ ( '%s ago ' , 'supportflow ' ), human_time_diff ( $ modified_gmt ) );
999+
1000+ if ( 'private ' == $ status ) {
1001+ $ reply_author = get_post_meta ( $ reply ->ID , 'reply_author ' , true );
1002+ $ reply_timestamp = sprintf ( __ ( 'Noted by %1$s on %2$s at %3$s ' , 'supportflow ' ), $ reply_author , get_the_date ( '' , $ reply ->ID ), get_the_time ( '' , $ reply ->ID ) );
1003+ }
1004+ if ( 'public ' == $ status ) {
1005+ $ reply_timestamp = sprintf ( __ ( '%s at %s ' , 'supportflow ' ), get_the_date ( '' , $ reply ->ID ), get_the_time ( '' , $ reply ->ID ) );
1006+ }
1007+
1008+ $ modified_gmt = get_post_modified_time ( 'U ' , true , $ reply ->ID );
1009+ $ last_activity = sprintf ( __ ( '%s ago ' , 'supportflow ' ), human_time_diff ( $ modified_gmt ) );
10181010 echo '<div class="ticket-meta"><span class="reply-timestamp"> ' . esc_html ( $ reply_timestamp ) . ' ( ' . $ last_activity . ') ' . '</span></div> ' ;
10191011 echo '</li> ' ;
10201012 }
10211013 echo '</ul> ' ;
10221014 }
1023-
10241015 echo '<div class="clear"></div> ' ;
1025-
10261016 }
10271017
10281018 /**
0 commit comments