@@ -956,53 +956,36 @@ public function meta_box_replies() {
956
956
}
957
957
958
958
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
+ );
960
963
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 ;
986
967
}
987
- echo '</ul> ' ;
988
- }
989
968
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
+
993
972
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 );
996
973
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
+
1000
983
echo '<div class="ticket-reply"> ' ;
1001
984
$ post_content = wpautop ( stripslashes ( $ reply ->post_content ) );
1002
- // Make link clickable
1003
985
$ post_content = make_clickable ( $ post_content );
1004
986
$ post_content = $ this ->hide_quoted_text ( $ post_content );
1005
987
echo $ post_content ;
988
+
1006
989
if ( $ attachment_ids = get_post_meta ( $ reply ->ID , 'sf_attachments ' ) ) {
1007
990
echo '<ul class="ticket-reply-attachments"> ' ;
1008
991
foreach ( $ attachment_ids as $ attachment_id ) {
@@ -1012,17 +995,23 @@ public function display_ticket_replies() {
1012
995
echo '</ul> ' ;
1013
996
}
1014
997
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 ) );
998
+
999
+ if ( 'private ' == $ status ) {
1000
+ $ reply_author = get_post_meta ( $ reply ->ID , 'reply_author ' , true );
1001
+ $ 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 ) );
1002
+ }
1003
+ if ( 'public ' == $ status ) {
1004
+ $ reply_timestamp = sprintf ( __ ( '%s at %s ' , 'supportflow ' ), get_the_date ( '' , $ reply ->ID ), get_the_time ( '' , $ reply ->ID ) );
1005
+ }
1006
+
1007
+ $ modified_gmt = get_post_modified_time ( 'U ' , true , $ reply ->ID );
1008
+ $ last_activity = sprintf ( __ ( '%s ago ' , 'supportflow ' ), human_time_diff ( $ modified_gmt ) );
1018
1009
echo '<div class="ticket-meta"><span class="reply-timestamp"> ' . esc_html ( $ reply_timestamp ) . ' ( ' . $ last_activity . ') ' . '</span></div> ' ;
1019
1010
echo '</li> ' ;
1020
1011
}
1021
1012
echo '</ul> ' ;
1022
1013
}
1023
-
1024
1014
echo '<div class="clear"></div> ' ;
1025
-
1026
1015
}
1027
1016
1028
1017
/**
0 commit comments