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-' . $activities_template->activity->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 ); |
| 834 | $template = locate_template( 'activity/comment.php', false, false ); |
| 835 | |
| 836 | // Backward compatibility. In older versions of BP, the markup was |
| 837 | // generated in the PHP instead of a template. This ensures that |
| 838 | // older themes (which are not children of bp-default and won't |
| 839 | // have the new template) will still work. |
| 840 | if ( !$template ) { |
| 841 | $template = BP_PLUGIN_DIR . '/bp-themes/bp-default/activity/comment.php'; |
861 | | return apply_filters( 'bp_activity_recurse_comments', $content ); |
862 | | } |
| 896 | /** |
| 897 | * Echoes the user_id of the author of the activity comment currently being displayed |
| 898 | * |
| 899 | * @package BuddyPress |
| 900 | * @subpackage Activity Template |
| 901 | * @since 1.3 |
| 902 | */ |
| 903 | function bp_activity_comment_user_id() { |
| 904 | echo bp_get_activity_comment_user_id(); |
| 905 | } |
| 906 | /** |
| 907 | * Gets the user_id of the author of the activity comment currently being displayed |
| 908 | * |
| 909 | * @package BuddyPress |
| 910 | * @subpackage Activity Template |
| 911 | * @since 1.3 |
| 912 | * |
| 913 | * @return int $user_id The user_id of the author of the displayed activity comment |
| 914 | */ |
| 915 | function bp_get_activity_comment_user_id() { |
| 916 | global $activities_template; |
| 917 | |
| 918 | $user_id = isset( $activities_template->activity->current_comment->user_id ) ? $activities_template->activity->current_comment->user_id : false; |
| 919 | |
| 920 | return apply_filters( 'bp_activity_comment_user_id', $user_id ); |
| 921 | } |
| 922 | |
| 923 | /** |
| 924 | * Echoes the author link for the activity comment currently being displayed |
| 925 | * |
| 926 | * @package BuddyPress |
| 927 | * @subpackage Activity Template |
| 928 | * @since 1.3 |
| 929 | */ |
| 930 | function bp_activity_comment_user_link() { |
| 931 | echo bp_get_activity_comment_user_link(); |
| 932 | } |
| 933 | /** |
| 934 | * Gets the author link for the activity comment currently being displayed |
| 935 | * |
| 936 | * @package BuddyPress |
| 937 | * @subpackage Activity Template |
| 938 | * @since 1.3 |
| 939 | * |
| 940 | * @return str $user_link The URL of the activity comment author's profile |
| 941 | */ |
| 942 | function bp_get_activity_comment_user_link() { |
| 943 | $user_link = bp_core_get_user_domain( bp_get_activity_comment_user_id() ); |
| 944 | |
| 945 | return apply_filters( 'bp_activity_comment_user_link', $user_link ); |
| 946 | } |
| 947 | |
| 948 | /** |
| 949 | * Echoes the author name for the activity comment currently being displayed |
| 950 | * |
| 951 | * @package BuddyPress |
| 952 | * @subpackage Activity Template |
| 953 | * @since 1.3 |
| 954 | */ |
| 955 | function bp_activity_comment_name() { |
| 956 | echo bp_get_activity_comment_name(); |
| 957 | } |
| 958 | /** |
| 959 | * Gets the author name for the activity comment currently being displayed |
| 960 | * |
| 961 | * The use of the bp_acomment_name filter is deprecated. Please use bp_activity_comment_name |
| 962 | * |
| 963 | * @package BuddyPress |
| 964 | * @subpackage Activity Template |
| 965 | * @since 1.3 |
| 966 | * |
| 967 | * @return str $name The full name of the activity comment author |
| 968 | */ |
| 969 | function bp_get_activity_comment_name() { |
| 970 | global $activities_template; |
| 971 | |
| 972 | $name = apply_filters( 'bp_acomment_name', $activities_template->activity->current_comment->user_fullname, $activities_template->activity->current_comment ); // backward compatibility |
| 973 | |
| 974 | return apply_filters( 'bp_activity_comment_name', $name ); |
| 975 | } |
| 976 | |
| 977 | /** |
| 978 | * Echoes the date_recorded of the activity comment currently being displayed |
| 979 | * |
| 980 | * @package BuddyPress |
| 981 | * @subpackage Activity Template |
| 982 | * @since 1.3 |
| 983 | */ |
| 984 | function bp_activity_comment_date_recorded() { |
| 985 | echo bp_get_activity_comment_date_recorded(); |
| 986 | } |
| 987 | /** |
| 988 | * Gets the date_recorded for the activity comment currently being displayed |
| 989 | * |
| 990 | * @package BuddyPress |
| 991 | * @subpackage Activity Template |
| 992 | * @since 1.3 |
| 993 | * |
| 994 | * @return str $date_recorded Time since the activity was recorded, of the form "%s ago" |
| 995 | */ |
| 996 | function bp_get_activity_comment_date_recorded() { |
| 997 | global $activities_template; |
| 998 | |
| 999 | if ( empty( $activities_template->activity->current_comment->date_recorded ) ) |
| 1000 | return false; |
| 1001 | |
| 1002 | $date_recorded = sprintf( __( '%s ago', 'buddypress' ), bp_core_time_since( $activities_template->activity->current_comment->date_recorded ) ); |
| 1003 | |
| 1004 | return apply_filters( 'bp_activity_comment_date_recorded', $date_recorded ); |
| 1005 | } |
| 1006 | |
| 1007 | /** |
| 1008 | * Echoes the 'delete' URL for the activity comment currently being displayed |
| 1009 | * |
| 1010 | * @package BuddyPress |
| 1011 | * @subpackage Activity Template |
| 1012 | * @since 1.3 |
| 1013 | */ |
| 1014 | function bp_activity_comment_delete_link() { |
| 1015 | echo bp_get_activity_comment_delete_link(); |
| 1016 | } |
| 1017 | /** |
| 1018 | * Gets the 'delete' URL for the activity comment currently being displayed |
| 1019 | * |
| 1020 | * @package BuddyPress |
| 1021 | * @subpackage Activity Template |
| 1022 | * @since 1.3 |
| 1023 | * |
| 1024 | * @return str $link The nonced URL for deleting the current activity comment |
| 1025 | */ |
| 1026 | function bp_get_activity_comment_delete_link() { |
| 1027 | global $bp; |
| 1028 | |
| 1029 | $link = wp_nonce_url( bp_get_root_domain() . '/' . $bp->activity->slug . '/delete/?cid=' . bp_get_activity_comment_id(), 'bp_activity_delete_link' ); |
| 1030 | |
| 1031 | return apply_filters( 'bp_activity_comment_delete_link', $link ); |
| 1032 | } |
| 1033 | |
| 1034 | /** |
| 1035 | * Echoes the content of the activity comment currently being displayed |
| 1036 | * |
| 1037 | * @package BuddyPress |
| 1038 | * @subpackage Activity Template |
| 1039 | * @since 1.3 |
| 1040 | */ |
| 1041 | function bp_activity_comment_content() { |
| 1042 | echo bp_get_activity_comment_content(); |
| 1043 | } |
| 1044 | /** |
| 1045 | * Gets the content of the activity comment currently being displayed |
| 1046 | * |
| 1047 | * The content is run through two filters. bp_get_activity_content will apply all filters |
| 1048 | * applied to activity items in general. Use bp_activity_comment_content to modify the |
| 1049 | * content of activity comments only. |
| 1050 | * |
| 1051 | * @package BuddyPress |
| 1052 | * @subpackage Activity Template |
| 1053 | * @since 1.3 |
| 1054 | * |
| 1055 | * @return str $content The content of the current activity comment |
| 1056 | */ |
| 1057 | function bp_get_activity_comment_content() { |
| 1058 | global $activities_template; |
| 1059 | |
| 1060 | $content = apply_filters( 'bp_get_activity_content', $activities_template->activity->current_comment->content ); |
| 1061 | |
| 1062 | return apply_filters( 'bp_activity_comment_content', $content ); |
| 1063 | } |