Thanks .
I read those pages before . The first one is about 9 month ago and it is closed to new replies . I can’t find any solution there .
The second one is about how to hide comments completely in activity stream but it’s nice to see them just by one click on the activities .
@mahdiar,
here’s a working snipppet found on WPMUDev which add a show/hide comments button above each activity item.
To see the button you must enable “allow blog and forum comments” in BP settings.
Add the script to bp-custom.php or child theme functions.php
add_action( 'wp_footer', 'add_comment_hide_show' );
function add_comment_hide_show() {
?>
<style>
.single-group .activity-comments ul{display: none;}
</style>
<script type="text/javascript">
jQuery(function($) {
setInterval(function() {
$('.activity-meta').each(function() {
if( !$(this).find('.show-comments').length ){
var html = '<a href="#" class="button bp-primary-action show-comments">Show/Hide Comments</a>';
$(this).find('.button.acomment-reply').after(html);
}
});
}, 500);
$('body').on('click', '.show-comments', function(e) {
e.preventDefault();
var obj = $(this).closest('.activity-content').next('.activity-comments').find('ul');
obj.slideToggle();
return false;
});
});
</script>
<?php
}
Thanks a lot !
-I tried jquery for the main comments button but it wasn’t worked . Is it possible ?
-I just delete “.single-group” in style to make the comments hidden at first . Is it necessary ?