Ticket #3388: 3388.004.patch
File 3388.004.patch, 10.3 KB (added by , 12 years ago) |
---|
-
bp-activity/bp-activity-actions.php
534 534 function bp_activity_action_mentions_feed() { 535 535 global $wp_query; 536 536 537 if ( !bp_ is_user_activity() || !bp_is_current_action( 'mentions' ) || !bp_is_action_variable( 'feed', 0 ) )537 if ( !bp_activity_do_mentions() || !bp_is_user_activity() || !bp_is_current_action( 'mentions' ) || !bp_is_action_variable( 'feed', 0 ) ) 538 538 return false; 539 539 540 540 $wp_query->is_404 = false; -
bp-activity/bp-activity-filters.php
86 86 add_filter( 'bp_get_activity_latest_update_excerpt', 'bp_activity_make_nofollow_filter' ); 87 87 add_filter( 'bp_get_activity_feed_item_description', 'bp_activity_make_nofollow_filter' ); 88 88 89 add_filter( 'pre_comment_content', 'bp_activity_at_name_filter' ); 90 add_filter( 'group_forum_topic_text_before_save', 'bp_activity_at_name_filter' ); 91 add_filter( 'group_forum_post_text_before_save', 'bp_activity_at_name_filter' ); 92 add_filter( 'the_content', 'bp_activity_at_name_filter' ); 89 if ( bp_activity_do_mentions() ) { 90 add_filter( 'pre_comment_content', 'bp_activity_at_name_filter' ); 91 add_filter( 'group_forum_topic_text_before_save', 'bp_activity_at_name_filter' ); 92 add_filter( 'group_forum_post_text_before_save', 'bp_activity_at_name_filter' ); 93 add_filter( 'the_content', 'bp_activity_at_name_filter' ); 94 } 93 95 94 96 add_filter( 'bp_get_activity_parent_content', 'bp_create_excerpt' ); 95 97 … … 99 101 /** Actions *******************************************************************/ 100 102 101 103 // At-name filter 102 add_action( 'bp_activity_before_save', 'bp_activity_at_name_filter_updates' ); 104 if ( bp_activity_do_mentions() ) 105 add_action( 'bp_activity_before_save', 'bp_activity_at_name_filter_updates' ); 103 106 104 107 // Activity stream moderation 105 108 add_action( 'bp_activity_before_save', 'bp_activity_check_moderation_keys', 2, 1 ); … … 207 210 * @return string $content Content filtered for mentions 208 211 */ 209 212 function bp_activity_at_name_filter( $content, $activity_id = 0 ) { 213 214 // Are mentions disabled? 215 if ( !bp_activity_do_mentions() ) 216 return $content; 210 217 211 218 // Try to find mentions 212 219 $usernames = bp_activity_find_mentions( $content ); … … 237 244 * @uses bp_activity_find_mentions() 238 245 */ 239 246 function bp_activity_at_name_filter_updates( $activity ) { 247 // Are mentions disabled? 248 if ( !bp_activity_do_mentions() ) 249 return; 250 240 251 // If activity was marked as spam, stop the rest of this function. 241 252 if ( ! empty( $activity->is_spam ) ) 242 253 return; 243 254 244 255 // Try to find mentions 245 256 $usernames = bp_activity_find_mentions( $activity->content ); 246 257 … … 271 282 * @uses bp_activity_update_mention_count_for_user() 272 283 */ 273 284 function bp_activity_at_name_send_emails( $activity ) { 285 // Are mentions disabled? 286 if ( !bp_activity_do_mentions() ) 287 return; 288 274 289 // If our temporary variable doesn't exist, stop now. 275 290 if ( empty( buddypress()->activity->mentioned_users ) ) 276 291 return; … … 363 378 364 379 return apply_filters( 'bp_activity_truncate_entry', $excerpt, $text, $append_text ); 365 380 } 381 382 /** 383 * Are mentions enabled or disabled? 384 * 385 * @package BuddyPress Activity 386 * @since 1.8 387 * 388 * @uses apply_filters() To call 'bp_activity_do_mentions' hook. 389 * @return bool $retval True to enable mentions, false to disable. Defaults to true. 390 */ 391 function bp_activity_do_mentions() { 392 // Default to true 393 $retval = true; 394 395 return (bool) apply_filters( 'bp_activity_do_mentions', $retval ); 396 } 397 No newline at end of file -
bp-activity/bp-activity-loader.php
150 150 ); 151 151 152 152 // @ mentions 153 $sub_nav[] = array( 154 'name' => __( 'Mentions', 'buddypress' ), 155 'slug' => 'mentions', 156 'parent_url' => $activity_link, 157 'parent_slug' => $this->slug, 158 'screen_function' => 'bp_activity_screen_mentions', 159 'position' => 20, 160 'item_css_id' => 'activity-mentions' 161 ); 153 if ( bp_activity_do_mentions() ) { 154 $sub_nav[] = array( 155 'name' => __( 'Mentions', 'buddypress' ), 156 'slug' => 'mentions', 157 'parent_url' => $activity_link, 158 'parent_slug' => $this->slug, 159 'screen_function' => 'bp_activity_screen_mentions', 160 'position' => 20, 161 'item_css_id' => 'activity-mentions' 162 ); 163 } 162 164 163 165 // Favorite activity items 164 166 $sub_nav[] = array( … … 228 230 $activity_link = trailingslashit( $user_domain . $this->slug ); 229 231 230 232 // Unread message count 231 $count = bp_get_total_mention_count_for_user( bp_loggedin_user_id() ); 232 if ( !empty( $count ) ) { 233 $title = sprintf( __( 'Mentions <span class="count">%s</span>', 'buddypress' ), number_format_i18n( $count ) ); 234 } else { 235 $title = __( 'Mentions', 'buddypress' ); 233 if ( bp_activity_do_mentions() ) { 234 $count = bp_get_total_mention_count_for_user( bp_loggedin_user_id() ); 235 if ( !empty( $count ) ) { 236 $title = sprintf( __( 'Mentions <span class="count">%s</span>', 'buddypress' ), number_format_i18n( $count ) ); 237 } else { 238 $title = __( 'Mentions', 'buddypress' ); 239 } 236 240 } 237 241 238 242 // Add the "Activity" sub menu … … 244 248 ); 245 249 246 250 // Mentions 247 $wp_admin_nav[] = array( 248 'parent' => 'my-account-' . $this->id, 249 'id' => 'my-account-' . $this->id . '-mentions', 250 'title' => $title, 251 'href' => trailingslashit( $activity_link . 'mentions' ) 252 ); 251 if ( bp_activity_do_mentions() ) { 252 $wp_admin_nav[] = array( 253 'parent' => 'my-account-' . $this->id, 254 'id' => 'my-account-' . $this->id . '-mentions', 255 'title' => $title, 256 'href' => trailingslashit( $activity_link . 'mentions' ) 257 ); 258 } 253 259 254 260 // Personal 255 261 $wp_admin_nav[] = array( -
bp-activity/bp-activity-screens.php
265 265 */ 266 266 function bp_activity_screen_notification_settings() { 267 267 268 if ( !$mention = bp_get_user_meta( bp_displayed_user_id(), 'notification_activity_new_mention', true ) ) 269 $mention = 'yes'; 268 if ( bp_activity_do_mentions() ) { 269 if ( !$mention = bp_get_user_meta( bp_displayed_user_id(), 'notification_activity_new_mention', true ) ) 270 $mention = 'yes'; 271 } 270 272 271 273 if ( !$reply = bp_get_user_meta( bp_displayed_user_id(), 'notification_activity_new_reply', true ) ) 272 274 $reply = 'yes'; ?> … … 282 284 </thead> 283 285 284 286 <tbody> 287 <?php if ( bp_activity_do_mentions() ) : ?> 285 288 <tr id="activity-notification-settings-mentions"> 286 289 <td> </td> 287 290 <td><?php printf( __( 'A member mentions you in an update using "@%s"', 'buddypress' ), bp_core_get_username( bp_displayed_user_id() ) ) ?></td> 288 291 <td class="yes"><input type="radio" name="notifications[notification_activity_new_mention]" value="yes" <?php checked( $mention, 'yes', true ) ?>/></td> 289 292 <td class="no"><input type="radio" name="notifications[notification_activity_new_mention]" value="no" <?php checked( $mention, 'no', true ) ?>/></td> 290 293 </tr> 294 <?php endif; ?> 291 295 <tr id="activity-notification-settings-replies"> 292 296 <td> </td> 293 297 <td><?php _e( "A member replies to an update or comment you've posted", 'buddypress' ) ?></td> -
bp-activity/bp-activity-template.php
419 419 break; 420 420 case 'mentions': 421 421 422 // Are mentions disabled? 423 if ( bp_activity_do_mentions() ) 424 return false; 425 422 426 // Start search at @ symbol and stop search at closing tag delimiter. 423 427 $search_terms = '@' . bp_core_get_username( $user_id ) . '<'; 424 428 $display_comments = 'stream'; … … 2770 2774 $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() . '/feed/'; 2771 2775 elseif ( 'favorites' == bp_current_action() ) 2772 2776 $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/favorites/feed/'; 2773 elseif ( 'mentions' == bp_current_action() )2777 elseif ( 'mentions' == bp_current_action() && bp_activity_do_mentions() ) 2774 2778 $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/mentions/feed/'; 2775 2779 else 2776 2780 $link = ''; -
bp-themes/bp-default/activity/index.php
72 72 73 73 <?php endif; ?> 74 74 75 <?php if ( bp_activity_do_mentions() ) : ?> 76 75 77 <?php do_action( 'bp_before_activity_type_tab_mentions' ); ?> 76 78 77 79 <li id="activity-mentions"><a href="<?php echo bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/'; ?>" title="<?php _e( 'Activity that I have been mentioned in.', 'buddypress' ); ?>"><?php _e( 'Mentions', 'buddypress' ); ?><?php if ( bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) : ?> <strong><span><?php printf( _nx( '%s new', '%s new', bp_get_total_mention_count_for_user( bp_loggedin_user_id() ), 'Number of new activity mentions', 'buddypress' ), bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ); ?></span></strong><?php endif; ?></a></li> 80 81 <?php endif; ?> 78 82 79 83 <?php endif; ?> 80 84 -
bp-themes/bp-default/functions.php
119 119 add_action( 'bp_member_header_actions', 'bp_add_friend_button', 5 ); 120 120 121 121 // Activity button 122 if ( bp_is_active( 'activity' ) )122 if ( bp_is_active( 'activity' ) && bp_activity_do_mentions() ) 123 123 add_action( 'bp_member_header_actions', 'bp_send_public_message_button', 20 ); 124 124 125 125 // Messages button