| 804 | | if ( empty( $comment_child->user_fullname ) ) |
| 805 | | $comment_child->user_fullname = $comment_child->display_name; |
| 806 | | |
| 807 | | if ( empty( $comment_child->user_nicename ) ) |
| 808 | | $comment_child->user_nicename = ''; |
| 809 | | |
| 810 | | if ( empty( $comment_child->user_login ) ) |
| 811 | | $comment_child->user_login = ''; |
| 812 | | |
| 813 | | if ( empty( $comment_child->user_email ) ) |
| 814 | | $comment_child->user_email = ''; |
| 815 | | |
| 816 | | $content .= '<li id="acomment-' . $comment_child->id . '">'; |
| 817 | | $content .= '<div class="acomment-avatar"><a href="' . |
| 818 | | bp_core_get_user_domain( |
| 819 | | $comment_child->user_id, |
| 820 | | $comment_child->user_nicename, |
| 821 | | $comment_child->user_login ) . '">' . |
| 822 | | bp_core_fetch_avatar( array( |
| 823 | | 'alt' => __( 'Profile picture of %s', 'buddypress' ), |
| 824 | | 'item_id' => $comment_child->user_id, |
| 825 | | 'width' => 30, |
| 826 | | 'height' => 30, |
| 827 | | 'email' => $comment_child->user_email |
| 828 | | ) ) . |
| 829 | | '</a></div>'; |
| 830 | | |
| 831 | | $content .= '<div class="acomment-meta"><a href="' . |
| 832 | | bp_core_get_user_domain( |
| 833 | | $comment_child->user_id, |
| 834 | | $comment_child->user_nicename, |
| 835 | | $comment_child->user_login ) . '">' . |
| 836 | | apply_filters( 'bp_acomment_name', $comment_child->user_fullname, $comment_child ) . |
| 837 | | '</a> · ' . sprintf( __( '%s ago', 'buddypress' ), bp_core_time_since( $comment_child->date_recorded ) ); |
| 838 | | |
| 839 | | // Reply link - the span is so that threaded reply links can be |
| 840 | | // hidden when JS is off. |
| 841 | | if ( is_user_logged_in() && bp_activity_can_comment_reply( $comment ) ) |
| 842 | | $content .= apply_filters( 'bp_activity_comment_reply_link', '<span class="acomment-replylink"> · <a href="#acomment-' . $comment_child->id . '" class="acomment-reply" id="acomment-reply-' . $comment->id . '">' . __( 'Reply', 'buddypress' ) . '</a></span>', $comment_child ); |
| 843 | | |
| 844 | | // Delete link |
| 845 | | if ( $bp->loggedin_user->is_super_admin || $bp->loggedin_user->id == $comment->user_id ) { |
| 846 | | $delete_url = wp_nonce_url( bp_get_root_domain() . '/' . $bp->activity->slug . '/delete/?cid=' . $comment_child->id, 'bp_activity_delete_link' ); |
| 847 | | $content .= apply_filters( 'bp_activity_comment_delete_link', ' · <a href="' . $delete_url . '" class="delete acomment-delete confirm" rel="nofollow">' . __( 'Delete', 'buddypress' ) . '</a>', $comment_child, $delete_url ); |
| 848 | | } |
| 849 | | |
| 850 | | $content .= '</div>'; |
| 851 | | $content .= '<div class="acomment-content">' . apply_filters( 'bp_get_activity_content', $comment_child->content ) . '</div>'; |
| 852 | | |
| 853 | | $content .= bp_activity_recurse_comments( $comment_child ); |
| 854 | | $content .= '</li>'; |
| 855 | | |
| 856 | | // Unset in the global in case of the last iteration |
| | 808 | locate_template( 'activity/comment.php', true, false ); |
| | 809 | |
| | 817 | function bp_activity_current_comment() { |
| | 818 | global $activities_template; |
| | 819 | |
| | 820 | $current_comment = !empty( $activities_template->activity->current_comment ) ? $activities_template->activity->current_comment : false; |
| | 821 | |
| | 822 | return apply_filters( 'bp_activity_current_comment', $current_comment ); |
| | 823 | } |
| | 824 | |
| | 825 | function bp_activity_comment_id() { |
| | 826 | echo bp_get_activity_comment_id(); |
| | 827 | } |
| | 828 | function bp_get_activity_comment_id() { |
| | 829 | global $activities_template; |
| | 830 | |
| | 831 | $comment_id = isset( $activities_template->activity->current_comment->id ) ? $activities_template->activity->current_comment->id : false; |
| | 832 | |
| | 833 | return apply_filters( 'bp_activity_comment_id', $comment_id ); |
| | 834 | } |
| | 835 | |
| | 836 | function bp_activity_comment_user_id() { |
| | 837 | echo bp_get_activity_comment_user_id(); |
| | 838 | } |
| | 839 | function bp_get_activity_comment_user_id() { |
| | 840 | global $activities_template; |
| | 841 | |
| | 842 | $user_id = isset( $activities_template->activity->current_comment->user_id ) ? $activities_template->activity->current_comment->user_id : false; |
| | 843 | |
| | 844 | return apply_filters( 'bp_activity_comment_user_id', $user_id ); |
| | 845 | } |
| | 846 | |
| | 847 | function bp_activity_comment_user_link() { |
| | 848 | echo bp_get_activity_comment_user_link(); |
| | 849 | } |
| | 850 | function bp_get_activity_comment_user_link() { |
| | 851 | $user_link = bp_core_get_user_domain( bp_get_activity_comment_user_id() ); |
| | 852 | |
| | 853 | return apply_filters( 'bp_activity_comment_user_link', $user_link ); |
| | 854 | } |
| | 855 | |
| | 856 | function bp_activity_comment_name() { |
| | 857 | echo bp_get_activity_comment_name(); |
| | 858 | } |
| | 859 | function bp_get_activity_comment_name() { |
| | 860 | global $activities_template; |
| | 861 | |
| | 862 | $name = apply_filters( 'bp_acomment_name', $activities_template->activity->current_comment->user_fullname, $activities_template->activity->current_comment ); // bp_acomment_name is for backward compatibility |
| | 863 | |
| | 864 | return apply_filters( 'bp_activity_comment_name', $name ); |
| | 865 | } |
| | 866 | |
| | 867 | function bp_activity_comment_date_recorded() { |
| | 868 | echo bp_get_activity_comment_date_recorded(); |
| | 869 | } |
| | 870 | function bp_get_activity_comment_date_recorded() { |
| | 871 | global $activities_template; |
| | 872 | |
| | 873 | if ( empty( $activities_template->activity->current_comment->date_recorded ) ) |
| | 874 | return false; |
| | 875 | |
| | 876 | $date_recorded = sprintf( __( '%s ago', 'buddypress' ), bp_core_time_since( $activities_template->activity->current_comment->date_recorded ) ); |
| | 877 | |
| | 878 | return apply_filters( 'bp_activity_comment_date_recorded', $date_recorded ); |
| | 879 | } |
| | 880 | |
| | 881 | function bp_activity_comment_delete_link() { |
| | 882 | echo bp_get_activity_comment_delete_link(); |
| | 883 | } |
| | 884 | function bp_get_activity_comment_delete_link() { |
| | 885 | global $bp; |
| | 886 | |
| | 887 | $link = wp_nonce_url( bp_get_root_domain() . '/' . $bp->activity->slug . '/delete/?cid=' . bp_get_activity_comment_id(), 'bp_activity_delete_link' ); |
| | 888 | |
| | 889 | return apply_filters( 'bp_activity_comment_delete_link', $link ); |
| | 890 | } |
| | 891 | |
| | 892 | function bp_activity_comment_content() { |
| | 893 | echo bp_get_activity_comment_content(); |
| | 894 | } |
| | 895 | function bp_get_activity_comment_content() { |
| | 896 | global $activities_template; |
| | 897 | |
| | 898 | $content = apply_filters( 'bp_get_activity_content', $activities_template->activity->current_comment->content ); |
| | 899 | |
| | 900 | return apply_filters( 'bp_activity_comment_content', $content ); |
| | 901 | } |
| | 902 | |