Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of Hugo

How To Remove Sub-Reply Button? (12 posts)

Started 1 year ago by: JamieWade

  • Profile picture of JamieWade JamieWade said 1 year ago:

    Was wondering how to remove the reply to comments button? I figured there would be a huge formatting problem with many subsequent replies to people’s other replies. Here is a picture to show what I want to do. Please any help would be greatly appreciated:
    Photobucket

  • Profile picture of JamieWade JamieWade said 1 year ago:

    Worked it out! For those who are interested in how to do this, you need to go to wp-content/plugins/buddypress/bp-activity/bp-activity-templatetags.php and delete this code:

    if ( is_user_logged_in() )
    					$content .= '<span class="acomment-replylink"> &middot; <a href="#acomment-' . $comment->id . '" class="acomment-reply" id="acomment-reply-' . $activities_template->activity->id . '">' . __( 'Reply', 'buddypress' ) . '</a></span>';
  • Profile picture of Virtuali Virtuali said 1 year ago:

    Anytime you make changes to the core you will lose them next time you update buddypress.

  • Profile picture of Brandon Allen Brandon Allen said 1 year ago:

    You might try this rather than a core hack.

    function my_filter_activity_comment_reply_links( $content ) {
         preg_replace( '(<span class="acomment-replylink">).*?(</span>)', '', $content );
    
         return $content;
    }
    add_filter( 'bp_activity_recurse_comments', 'my_filter_activity_comment_reply_links' );

    I have not tested this, but, fingers crossed, it should work.

  • Profile picture of James James said 1 year ago:

    hi @cnorris23 ,

    fingers did not help, function returns:

    Warning: preg_replace() [function.preg-replace]: Unknown modifier ‘.’ in …… on line 2

  • Profile picture of Virtuali Virtuali said 1 year ago:

    You need to put this in your bp-custom.php

  • Profile picture of James James said 1 year ago:

    hi @gunju2221 ,

    did you really checked it with bp-custom?
    for me it returns same warning, not depending from where I put it.

  • Profile picture of Alan Alan said 1 year ago:

    you can try this: haven’t tested it…

    replace the preg_replace in fns.

    preg_replace( '#<span class="acomment-replylink">(.*)</span>#s', '', $content);
  • Profile picture of James James said 1 year ago:

    thanks Alan, this does not return warnings, but does not remove sub-replies too :)

  • Profile picture of Brandon Allen Brandon Allen said 1 year ago:

    Try this:

    function my_filter_activity_comment_reply_links( $content ) {
         preg_replace( '/(<span class="acomment-replylink">)(.*)(</span>)/g', '', $content);
    
         return $content;
    }

    Also, it should be noted that this code is not restricted to your bp-custom.php file. It can also go in your theme’s functions.php file.

  • Profile picture of James James said 1 year ago:

    thanks @cnorris23 ,
    but did not work for me again, don’t know, maybe I have some other function, which does not allow this one to work correctly. probably, will have to change core file and put it in some reminder.

  • Profile picture of Brandon Allen Brandon Allen said 1 year ago:

    I haven’t been testing these. I’ll try to test tonight and get you a working one. A core hack the last thing you want to do.