Exclude signature from being quoted

Hello,
URL: http://yourtechadvisors.com/forums/topic/testing/#post-5781

I am using the premium version of this plugin.
https://wordpress.org/plugins/gd-bbpress-tools/

Whenever someone clicks the Quote button, the signature is quoted with the content they are quoting. Is there anyway to stop this?

Here is the code that outputs the signatures.

/*Add database sync for signature field on front end*/
function my_bbp_reply_content_append_user_signature( $content = '', $reply_id = 0, $args = array() ) {
// Default arguments
$defaults = array(
'separator' => '<hr />',
'before' => '<div class="bbp-reply-signature">',
'after' => '</div>'
);
$r = wp_parse_args( $args, $defaults );
extract( $r );

// Verify topic id, get author id and potential signature
$reply_id = bbp_get_reply_id ( $reply_id );
$user_id = bbp_get_reply_author_id( $reply_id );

// Get fields data. Caution: name is case sensitive.
if(function_exists('bbpress') ) {
$signature = xprofile_get_field_data( 'Forum signature', $user_id );
}
else {
$signature = bbp_get_user_signature ( $user_id );
}

// If signature exists, adjust the content accordingly
if ( !empty( $signature ) )
$content = $content . $separator . $before . $signature . $after;

return apply_filters( 'my_bbp_reply_content_append_signature', $content, $reply_id, $separator );
}

if ( !is_admin() ) {
// remove the original BBPress filter
remove_filter( 'bbp_get_reply_content', 'bbp_reply_content_append_user_signature', 1, 2 );
// add our custom filter
add_filter( 'bbp_get_reply_content', 'my_bbp_reply_content_append_user_signature', 1, 2 );
}

Thanks,
Alex :smiley:

  • Sajid

    Hi Alex S,
    Hope you are doing good today :slight_smile:

    You can't see any settings to remove or exclude some part of the reply from being quoted. There must be an option like this in the plugin.

    If no, then you can simply hide the signature and hr in block quotes by adding following custom CSS code in style.css file of your child theme.

    blockquote .bbp-reply-signature, blockquote hr {
        display: none;
    }

    Take care and have a nice day :slight_smile:
    Cheers, Sajid

  • Sajid

    Hi Alex S,
    That's what I said my first reply :slight_smile:

    Anyway, as you mentioned that there is no option to exclude certain part of the quote content then we have to edit that plugin files directly. That is not a good idea because these changes will be lost when you will update the plugin.

    So, here I would recommend you to contact their support for assistance. I am sure they might have come across this issue before and might have a solution ready.

    Let us know what they says Alex :slight_smile:
    Cheers, Sajid

  • Alex Stine

    Hello,
    I managed to almost get it fixed in chat with the below code. Only 1 issue stands. That is that line spaces are now stripped from the signature, here is the new code with an adjusted priority.

    /*Add database sync for signature field on front end*/
    function my_bbp_reply_content_append_user_signature( $content = '', $reply_id = 0, $args = array() ) {
    // Default arguments
    $defaults = array(
    'separator' => '<hr />',
    'before' => '<div class="bbp-reply-signature">',
    'after' => '</div>'
    );
    $r = wp_parse_args( $args, $defaults );
    extract( $r );
    
    // Verify topic id, get author id and potential signature
    $reply_id = bbp_get_reply_id ( $reply_id );
    $user_id = bbp_get_reply_author_id( $reply_id );
    
    // Get fields data. Caution: name is case sensitive.
    if(function_exists('bbpress') ) {
    $signature = xprofile_get_field_data( 'Forum signature', $user_id );
    }
    else {
    $signature = bbp_get_user_signature ( $user_id );
    }
    
    // If signature exists, adjust the content accordingly
    if ( !empty( $signature ) )
    $content = $content . $separator . $before . $signature . $after;
    
    return apply_filters( 'my_bbp_reply_content_append_signature', $content, $reply_id, $separator );
    }
    
    if ( !is_admin() ) {
    // remove the original BBPress filter
    remove_filter( 'bbp_get_reply_content', 'bbp_reply_content_append_user_signature', 1, 2 );
    // add our custom filter
    add_filter( 'bbp_get_reply_content', 'my_bbp_reply_content_append_user_signature', 98, 2 );
    }

    How can I modify the code to not ignore line spaces but still keep the priority of the code low enough not to interfere with the quoting functionality?

    Please advise.

    Thanks,
    Alex :smiley:

  • Michael Bissett

    Edited the earlier code to read as follows:

    function my_bbp_reply_content_append_user_signature( $content = '', $reply_id = 0, $args = array() ) {
    // Default arguments
    $defaults = array(
    'separator' => '<hr class="bbp-sig-line" />',
    'before' => '<div class="bbp-reply-signature">',
    'after' => '</div>'
    );
    $r = wp_parse_args( $args, $defaults );
    extract( $r );
    
    // Verify topic id, get author id and potential signature
    $reply_id = bbp_get_reply_id ( $reply_id );
    $user_id = bbp_get_reply_author_id( $reply_id );
    
    // Get fields data. Caution: name is case sensitive.
    if(function_exists('bbpress') ) {
    $signature = wpautop(xprofile_get_field_data( 'Forum signature', $user_id ));
    }
    else {
    $signature = bbp_get_user_signature ( $user_id );
    }
    
    // If signature exists, adjust the content accordingly
    if ( !empty( $signature ) )
    $content = $content . '<br/>' . $separator . $before . $signature . $after;
    
    return apply_filters( 'my_bbp_reply_content_append_signature', $content, $reply_id, $separator );
    }
    
    if ( !is_admin() ) {
    // remove the original BBPress filter
    remove_filter( 'bbp_get_reply_content', 'bbp_reply_content_append_user_signature', 1, 2 );
    // add our custom filter
    add_filter( 'bbp_get_reply_content', 'my_bbp_reply_content_append_user_signature', 98, 2 );
    }

    And added in this CSS code:

    /* To account for changes in the display of bbPress signature */
    
    #bbpress-forums hr.bbp-sig-line {
        margin-left: -60px;
    }
    
    #bbpress-forums .bbp-reply-signature > p {
        font-size: 12px;
    }

    Can you confirm that it's working now?

    Please advise,
    Michael

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.