Skip to:
Content

BuddyPress.org

Changeset 3519


Ignore:
Timestamp:
12/05/2010 06:59:53 PM (16 years ago)
Author:
boonebgorges
Message:

Links blog activity item thumbnails to the original post. Fixes #2337

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity.php

    r3515 r3519  
    967967 * @package BuddyPress Activity
    968968 * @param $content str - The content to work with
     969 * @param $link str - Optional. The URL that the image should link to
    969970 * @return $content str - The content with images stripped and replaced with a single thumb.
    970971 */
    971 function bp_activity_thumbnail_content_images( $content ) {
     972function bp_activity_thumbnail_content_images( $content, $link = false ) {
     973        global $post;
     974
    972975        preg_match_all( '/<img[^>]*>/Ui', $content, $matches );
    973976        $content = preg_replace('/<img[^>]*>/Ui', '', $content );
    … …  
    995998                        $new_width = $new_height * $ratio;
    996999
    997                         $content = '<img src="' . esc_attr( $src) . '" width="' . $new_width . '" height="' . $new_height . '" alt="' . __( 'Thumbnail', 'buddypress' ) . '" class="align-left thumbnail" />' . $content;
     1000                        $image = '<img src="' . esc_attr( $src ) . '" width="' . $new_width . '" height="' . $new_height . '" alt="' . __( 'Thumbnail', 'buddypress' ) . '" class="align-left thumbnail" />';
     1001                       
     1002                        if ( !empty( $link ) ) {
     1003                                $image = '<a href="' . $link . '">' . $image . '</a>';
     1004                        }
     1005
     1006                        $content = $image . $content;
    9981007                }
    9991008        }
  • trunk/bp-blogs.php

    r3479 r3519  
    166166        /* Remove large images and replace them with just one image thumbnail */
    167167        if ( function_exists( 'bp_activity_thumbnail_content_images' ) && !empty( $content ) )
    168                 $content = bp_activity_thumbnail_content_images( $content );
     168                $content = bp_activity_thumbnail_content_images( $content, $primary_link );
    169169
    170170        if ( !empty( $action ) )
Note: See TracChangeset for help on using the changeset viewer.