Changeset 4367 for trunk/bp-activity/bp-activity-filters.php
- Timestamp:
- 05/15/2011 10:40:03 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-filters.php
r4305 r4367 113 113 * @param string $content The activity content 114 114 */ 115 function bp_activity_at_name_filter( $content ) { 115 function bp_activity_at_name_filter( $activity ) { 116 // Only run this function once for a given activity item 117 remove_filter( 'bp_activity_after_save', 'bp_activity_at_name_filter' ); 118 119 $content = $activity->content; 120 116 121 $usernames = bp_activity_find_mentions( $content ); 117 122 … … 126 131 127 132 // Increase the number of new @ mentions for the user 128 $new_mention_count = (int)get_user_meta( $user_id, 'bp_new_mention_count', true ); 129 update_user_meta( $user_id, 'bp_new_mention_count', $new_mention_count + 1 ); 133 bp_activity_adjust_mention_count( $activity->id, 'add' ); 130 134 131 135 $content = preg_replace( '/(@' . $username . '\b)/', "<a href='" . bp_core_get_user_domain( $user_id ) . "' rel='nofollow'>@$username</a>", $content ); 132 136 } 133 137 134 return $content; 138 // Resave the activity item with the linked usernames 139 $activity->content = $content; 140 $activity->save(); 135 141 } 136 add_filter( 'bp_activity_new_update_content', 'bp_activity_at_name_filter' ); 137 add_filter( 'groups_activity_new_update_content', 'bp_activity_at_name_filter' ); 138 add_filter( 'pre_comment_content', 'bp_activity_at_name_filter' ); 139 add_filter( 'group_forum_topic_text_before_save', 'bp_activity_at_name_filter' ); 140 add_filter( 'group_forum_post_text_before_save', 'bp_activity_at_name_filter' ); 141 add_filter( 'bp_activity_comment_content', 'bp_activity_at_name_filter' ); 142 add_filter( 'bp_activity_after_save', 'bp_activity_at_name_filter' ); 142 143 143 144 function bp_activity_make_nofollow_filter( $text ) {
Note: See TracChangeset
for help on using the changeset viewer.