function rmedia_single_comment($comment) { global $allowedtags; $html = ""; $html .= '<li class="rtmedia-comment">'; if ($comment['user_id']) { $user_link = "<a href='" . get_rtmedia_user_link($comment['user_id']) . "' title='" . rtmedia_get_author_name($comment['user_id']) . "'>" . rtmedia_get_author_name($comment['user_id']) . "</a>"; $user_name = apply_filters('rtmedia_comment_author_name', $user_link, $comment); $profile_pic = rtmedia_author_profile_pic($show_link = true, $echo = false, $comment['user_id']); } else { $user_name = "Annonymous"; $profile_pic = ""; } if ($profile_pic != "") { $html .= "<div class='rtmedia-comment-user-pic cleafix'>" . $profile_pic . "</div>"; } $html .= "<div class='rtm-comment-wrap'><div class='rtmedia-comment-details'>"; $html .= '<span class ="rtmedia-comment-author">' . '' . $user_name . '</span>'; $html .= '<span class ="rtmedia-comment-date"> ' . apply_filters('rtmedia_comment_date_format', rtmedia_convert_date($comment['comment_date_gmt']), $comment) . '</span>'; $comment_string = wp_kses($comment['comment_content'], $allowedtags); $html .= '<div class="rtmedia-comment-content">' . wpautop(make_clickable(apply_filters('bp_get_activity_content', $comment_string))) . '</div>'; global $rtmedia_media; if (is_rt_admin() || isset($comment['user_id']) && (get_current_user_id() == $comment['user_id'] || $rtmedia_media->media_author == get_current_user_id()) || apply_filters('rtmedia_allow_comment_delete', false)) { // show delete button for comment author and admins $html .= '<i data-id="' . $comment['comment_ID'] . '" class = "rtmedia-delete-comment dashicons dashicons-no-alt rtmicon" title="' . __('Delete Comment', 'rtmedia') . '"></i>'; } $html .= '<div class="clear"></div></div></div></li>'; return apply_filters('rtmedia_single_comment', $html, $comment); }
/** * Render single comment, * And display show all comment link to display all comment * @param [array] $comment [comment] * @param [int] $count [default false other ways comment count] * @param [int] $i [default false other ways increment with loop] * By: Yahil */ function rmedia_single_comment($comment, $count = false, $i = false) { $html = ''; $class = ''; if (isset($count) && $count) { $hide = $count - 5; if ($i < $hide) { $class = 'hide'; if (0 == $i) { echo '<div class="rtmedia-like-info"><span id="rtmedia_show_all_comment"> ' . esc_html('Show all ' . $count . ' comments', 'rtmedia') . ' </span></div>'; } } } global $allowedtags, $rtmedia_media; $html .= '<li class="rtmedia-comment ' . $class . ' ">'; if ($comment['user_id']) { $user_link = "<a href='" . esc_url(get_rtmedia_user_link($comment['user_id'])) . "' title='" . esc_attr(rtmedia_get_author_name($comment['user_id'])) . "'>" . esc_html(rtmedia_get_author_name($comment['user_id'])) . '</a>'; $user_name = apply_filters('rtmedia_comment_author_name', $user_link, $comment); $profile_pic = rtmedia_author_profile_pic($show_link = true, $echo = false, $comment['user_id']); } else { $user_name = 'Annonymous'; $profile_pic = ''; } if (!empty($profile_pic)) { $html .= "<div class='rtmedia-comment-user-pic cleafix'>" . $profile_pic . '</div>'; } $html .= "<div class='rtm-comment-wrap'><div class='rtmedia-comment-details'>"; $html .= '<span class ="rtmedia-comment-author">' . $user_name . '</span>'; $html .= '<span class ="rtmedia-comment-date"> ' . apply_filters('rtmedia_comment_date_format', rtmedia_convert_date($comment['comment_date_gmt']), $comment) . '</span>'; $comment_content = $comment['comment_content']; $activity_comment_content = get_comment_meta($comment['comment_ID'], 'activity_comment_content', true); if (empty($activity_comment_content)) { $activity_id = (int) get_comment_meta($comment['comment_ID'], 'activity_id', true); if ($activity_id) { $rtmedia_activity_comment = rtmedia_activity_comment($activity_id); if ($rtmedia_activity_comment['content']) { $comment_content = $rtmedia_activity_comment['content']; update_comment_meta($comment['comment_ID'], 'activity_comment_content', $rtmedia_activity_comment['content']); } } } else { $comment_content = $activity_comment_content; } $comment_string = wp_kses($comment_content, $allowedtags); $html .= '<div class="rtmedia-comment-content">' . wpautop(make_clickable(apply_filters('bp_get_activity_content', $comment_string))) . '</div>'; $html .= '<div class="rtmedia-comment-extra">' . apply_filters('rtmedia_comment_extra', '', $comment) . '</div>'; if (is_rt_admin() || isset($comment['user_id']) && (get_current_user_id() === intval($comment['user_id']) || intval($rtmedia_media->media_author) === get_current_user_id()) || apply_filters('rtmedia_allow_comment_delete', false)) { // show delete button for comment author and admins $html .= '<i data-id="' . esc_attr($comment['comment_ID']) . '" class = "rtmedia-delete-comment dashicons dashicons-no-alt rtmicon" title="' . esc_attr__('Delete Comment', 'buddypress-media') . '"></i>'; } $html .= '<div class="clear"></div></div></div></li>'; return apply_filters('rtmedia_single_comment', $html, $comment); }
<?php if ($rt_ajax_request) { ?> <div class="rtm-single-meta-contents<?php if (is_user_logged_in()) { echo " logged-in"; } ?> "> <div class="rtm-user-meta-details"> <div class="userprofile rtm-user-avatar"> <?php rtmedia_author_profile_pic(true); ?> </div> <div class="username"> <?php rtmedia_author_name(true); ?> </div> <div class="rtm-time-privacy clearfix"> <?php echo get_rtmedia_date_gmt(); ?> <?php echo get_rtmedia_privacy_symbol();
function rmedia_single_comment($comment) { $html = ""; $html .= '<li class="rtmedia-comment">'; if ($comment['user_id']) { $user_name = "<a href='" . get_rtmedia_user_link($comment['user_id']) . "' title='" . rtmedia_get_author_name($comment['user_id']) . "'>" . rtmedia_get_author_name($comment['user_id']) . "</a>"; $profile_pic = rtmedia_author_profile_pic($show_link = true, $echo = false, $comment['user_id']); } else { $user_name = "Annonymous"; $profile_pic = ""; } if ($profile_pic != "") { $html .= "<div class='rtmedia-comment-user-pic cleafix'>" . $profile_pic . "</div>"; } $html .= "<div><div class='rtmedia-comment-details'>"; $html .= '<span class ="rtmedia-comment-author">' . '' . $user_name . '</span>'; $html .= '<div class="rtmedia-comment-content">' . wpautop(make_clickable($comment['comment_content'])) . '</div>'; global $rtmedia_media; if (isset($comment['user_id']) && isset($rtmedia_media->media_author) && (is_rt_admin() || (get_current_user_id() == $comment['user_id'] || $rtmedia_media->media_author == get_current_user_id()))) { // show delete button for comment author and admins $html .= '<i data-id="' . $comment['comment_ID'] . '" class = "rtmedia-delete-comment rtmicon-times" title="' . __('Delete Comment') . '"></i>'; } $html .= '<span class ="rtmedia-comment-date"> ' . rtmedia_convert_date($comment['comment_date_gmt']) . '</span>'; $html .= '<div class="clear"></div></div></div></li>'; return apply_filters('rtmedia_single_comment', $html, $comment); }