Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/24/2011 07:18:57 PM (14 years ago)
Author:
boonebgorges
Message:

Cleans up use of bp_create_excerpt(). Fixes #3503. Props r-a-y

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-members/bp-members-template.php

    r4961 r5030  
    571571
    572572        $defaults = array(
    573             'length'    => 70,
     573            'length'    => 225,
    574574            'view_link' => true
    575575        );
    576576
    577577        $r = wp_parse_args( $args, $defaults );
    578         extract( $r, EXTR_SKIP );
    579 
    580         if ( !isset( $members_template->member->latest_update ) || !$update = maybe_unserialize( $members_template->member->latest_update ) )
     578        extract( $r );
     579
     580        if ( empty( $members_template->member->latest_update ) || !$update = maybe_unserialize( $members_template->member->latest_update ) )
    581581            return false;
    582582
    583         $update_content = apply_filters( 'bp_get_activity_latest_update', sprintf( _x( '- "%s"', 'member latest update in member directory', 'buddypress' ), trim( strip_tags( bp_create_excerpt( $update['content'], $length ) ) ) ) );
    584 
    585         if ( $view_link && !empty( $update['id'] ) && bp_is_active( 'activity' ) )
    586             $update_content .= ' <a href="' . bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/p/' . $update['id'] . '">' . __( 'View', 'buddypress' ) . '</a>';
     583        $update_content = apply_filters( 'bp_get_activity_latest_update_excerpt', sprintf( _x( '- &quot;%s &quot;', 'member latest update in member directory', 'buddypress' ), trim( strip_tags( bp_create_excerpt( $update['content'], $length ) ) ) ) );
     584
     585        // If $view_link is true and the text returned by bp_create_excerpt() is different from the original text (ie it's
     586        // been truncated), add the "View" link.
     587        if ( $view_link && ( $update_content != $update['content'] ) ) {
     588            $view = __( 'View', 'buddypress' );
     589
     590            $update_content .= '<span class="activity-read-more"><a href="' . bp_activity_get_permalink( $update['id'] ) . '" rel="nofollow">' . $view . '</a></span>';
     591        }
    587592
    588593        return apply_filters( 'bp_get_member_latest_update', $update_content );
Note: See TracChangeset for help on using the changeset viewer.