BuddyDev

Search

How can I hide comment from activity page

  • Inactive
    Level: Enlightened
    Posts: 28
    Kikismedia on #33339

    I want to hide the comment showing in the activity stream alone not on single Activity page

    I go this code from here

    add_action( ‘bp_after_has_activities_parse_args’, function ( $r ) {

    if ( ! bp_is_activity_directory() ) {
    return $r;
    }

    $r[‘display_comments’] = false;

    return $r;
    } );

    It worked but on the activity page the comment count disappears please I need your help

    Lastly

    How can I remove new comment activity from user activity stream

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2461
    Ravi on #33340

    Hello Adeala,

    Thank you for posting. Try the following way:

    
    add_action( 'bp_after_has_activities_parse_args', function ( $r ) {
    
    	if ( bp_is_activity_directory() || bp_is_single_activity() ) {
    		$r['display_comments'] = false;
    	}
    
    	return $r;
    } );
    
    

    Regards
    Ravi

  • Inactive
    Level: Enlightened
    Posts: 28
    Kikismedia on #33362

    Hi Ravi this code also hides comment in the single activity I don’t want that,
    I want it to hide comment in the activity page alone

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2461
    Ravi on #33372

    Hello Adeala,

    Please try the following code. It will hide comments on activity directory page.

    
    add_action( 'bp_after_has_activities_parse_args', function ( $r ) {
    
    	if ( bp_is_activity_directory() ) {
    		$r['display_comments'] = false;
    	}
    
    	return $r;
    } );
    
    

    Please le

  • Inactive
    Level: Enlightened
    Posts: 28
    Kikismedia on #33375

    It’s worked but the comment count also disappears

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2461
    Ravi on #33382

    Hello Adeala,

    Try the following code. It will hide comment using css on activity directory. Please remove the previous code

    
    add_action( 'wp_footer', function () {
    
    	if ( ! bp_is_activity_directory() ) {
    		return;
    	}
    
    	echo '<style>ul#activity-stream .activity-comments{display: none;}</style>';
    } );
    
    

    Regards
    Ravi

  • Participant
    Level: Initiated
    Posts: 2
    Denis Ray on #33582

    Hi Ravi and Adeala,

    I am trying to hide/collapse comments on activity page, group pages and user page. The comments will be visible when a user click on “show all comments”. I tried editing the buddypress.js file, by changing the default visble comments from 5 to 1, which did not work. I also tried the above code, it hid the comments on only activity page and clicking on comments do not reveal the comments. Kindly assist , thanks.

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2461
    Ravi on #33584

    Hello Denis,

    Thank you for posting. Please do let me on which platform you are working is it BuddyPress or BuddyBoss.
    If BuddyPress please let me know which template pack you are using.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2461
    Ravi on #33587

    Hello Danis,

    I have thought again on this and found you are making changes to “buddypress.js” which is not loading. Please try after rename it to “buddypress.min.js”.

    Regards
    Ravi

  • Participant
    Level: Initiated
    Posts: 2
    Denis Ray on #33722

    Hello Ravi, sorry for the late reply. As suggested, i edited the buddypress.min.js as well (I have both files in same folder), still no changes after saving.

You must be logged in to reply to this topic.

This topic is: not resolved