Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Avatar of MeRuud
    MeRuud
    Participant

    @meruud

    Thanks for your help. But I am confused, I don’t seem to be able to apply the filters?
    I tried `apply_filters (‘bp_activity_excerpt_length’, 500);` which doesn’t make a difference. If I try it with add_filter it gives unexpected value error.

    BTW what is the difference between the excerpt length from bp_activity_truncate_entry and the excerpt length from bp_create_excerpt? Is the first one solely for the activity stream?
    Same goes for bp_activity_excerpt_append_text vs. bp_excerpt_append_text.

    Thanks for your help,
    Ruud

    Avatar of MeRuud
    MeRuud
    Participant

    @meruud

    Not sure if this is what your looking for, but there is a plugin that converts all instances of displayname to username.

    Link: http://wordpress.org/extend/plugins/buddypress-usernames-only/
    .

    It hasn’t been updated in a while, but last time I used it it worked fine.

    Avatar of MeRuud
    MeRuud
    Participant

    @meruud

    Not sure why but this forum keeps cutting out links / random parts of my post.
    The second piece should be, for the content above to make sense:
    `remove_filter( ‘bp_create_excerpt’, $length, $options );
    function pnb_excerpt(){
    $lenght = 500;
    $options = array(
    ‘ending’ => __( ‘ […]‘, ‘buddypress’ ),
    ‘exact’ => false,
    ‘html’ => false,
    ‘filter_shortcodes’ => $filter_shortcodes_default);
    }
    add_filter( ‘bp_create_excerpt’, $length, $options );
    `

    Either way tried both of them.

    Thanks,
    Ruud

    Avatar of MeRuud
    MeRuud
    Participant

    @meruud

    So I think I found the part that creates / modifies the excerpt. It is in bp-core-template.php. Starting at line 353.
    `/**
    * Truncates text.
    */
    function bp_create_excerpt( $text, $length = 225, $options = array() ) {
    // Backward compatibility. The third argument used to be a boolean $filter_shortcodes
    $filter_shortcodes_default = is_bool( $options ) ? $options : true;

    $defaults = array(
    ‘ending’ => __( ‘ […]‘, ‘buddypress’ ),
    ‘exact’ => false,
    ‘html’ => true,
    ‘filter_shortcodes’ => $filter_shortcodes_default
    );
    $r = wp_parse_args( $options, $defaults );
    extract( $r );

    // Save the original text, to be passed along to the filter
    $original_text = $text;

    // Allow plugins to modify these values globally
    $length = apply_filters( ‘bp_excerpt_length’, $length );
    $ending = apply_filters( ‘bp_excerpt_append_text’, $ending );

    // Remove shortcodes if necessary
    if ( $filter_shortcodes )
    $text = strip_shortcodes( $text );`

    `remove_filter( ‘bp_create_excerpt’, $length, $options );
    function pnb_excerpt(){
    $lenght = 500;
    $options = array(
    ‘ending’ => __( ‘ […]‘, ‘buddypress’ ),
    ‘exact’ => false,
    ‘html’ => false,
    ‘filter_shortcodes’ => $filter_shortcodes_default);
    return apply_filters( ‘bp_create_excerpt’, $length, $options );
    }`

    I also tried with apply_filter, and without the remove_filter.
    How do I overwrite the defaults? (The $length, and the $options array).

    Thanks in advance,
    Ruud

    Avatar of MeRuud
    MeRuud
    Participant

    @meruud

    Found the answer, was looking at the wrong place.
    Not sure if this is the way to go but to get the permalink of the activity use:
    `bp_activity_get_permalink`

    So I used a variable then echo the variable in the comment link like this:
    `activity->id, $activities_template->activity ) ?>
    <a href="” class=”button acomment-reply bp-primary-action” id=”acomment-comment-”><?php printf( __( 'Comment %s‘, ‘buddypress’ ), bp_activity_get_comment_count() ); ?>`

    UPDATE:
    Use “
    Thanks,

Viewing 5 replies - 1 through 5 (of 5 total)