Skip to:
Content
Pages
Categories
Search
Top
Bottom

Edit "new post"-activity content


  • MeRuud
    Participant

    @meruud

    Hello all,

    I am trying to edit the activity when a new post is created. By default I think it creates a excerpt and displays this (and it also includes image attachments). I am trying to get it to show the entire post as it is, thus the entire text / videos / galleries etc.

    So far my search has let me to: bp_activity_content_body(). But I think the issue is more in what is retrieved from the post than what it outputs?

    If somebody can point me in the right direction to where to look for, that would be greatly appreciated.

    Thanks in advance,
    Ruud

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

  • 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


    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


    danbpfr
    Participant

    @chouf1

    see also the  function bp_activity_truncate_entry in bp-activity-filters.php


    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

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Edit "new post"-activity content’ is closed to new replies.
Skip to toolbar