Skip to:
Content

BuddyPress.org

Changeset 8717


Ignore:
Timestamp:
07/29/2014 02:01:59 PM (10 years ago)
Author:
johnjamesjacoby
Message:

In bp_get_activity_comment_permalink(), check that activity comment exists, and fallback on the regular activity permalink if it doesn't. Also pass $comment_id into the filter for easier tweaking.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-template.php

    r8697 r8717  
    23832383        global $activities_template;
    23842384
    2385         $link = bp_activity_get_permalink( $activities_template->activity->id, $activities_template->activity ) . '#acomment-' . $activities_template->activity->current_comment->id;
    2386 
    2387         return apply_filters( 'bp_get_activity_comment_permalink', $link );
     2385        // Check that comment exists
     2386        $comment_id = isset( $activities_template->activity->current_comment->id )
     2387            ? $activities_template->activity->current_comment->id
     2388            : 0;
     2389
     2390        // Setup the comment link
     2391        $comment_link = ! empty( $comment_id )
     2392            ? '#acomment-' .$comment_id
     2393            : false;
     2394
     2395        // Append comment ID to end of activity permalink
     2396        $link = bp_activity_get_permalink( $activities_template->activity->id, $activities_template->activity ) . $comment_link;
     2397
     2398        return apply_filters( 'bp_get_activity_comment_permalink', $link, $comment_id );
    23882399    }
    23892400
Note: See TracChangeset for help on using the changeset viewer.