Changeset 7193
- Timestamp:
- 06/09/2013 02:04:36 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-actions.php
r6981 r7193 535 535 global $wp_query; 536 536 537 if ( ! bp_activity_do_mentions() ) { 538 return false; 539 } 540 537 541 if ( !bp_is_user_activity() || !bp_is_current_action( 'mentions' ) || !bp_is_action_variable( 'feed', 0 ) ) 538 542 return false; -
trunk/bp-activity/bp-activity-filters.php
r6649 r7193 209 209 function bp_activity_at_name_filter( $content, $activity_id = 0 ) { 210 210 211 // Are mentions disabled? 212 if ( ! bp_activity_do_mentions() ) { 213 return $content; 214 } 215 211 216 // Try to find mentions 212 217 $usernames = bp_activity_find_mentions( $content ); … … 238 243 */ 239 244 function bp_activity_at_name_filter_updates( $activity ) { 245 // Are mentions disabled? 246 if ( ! bp_activity_do_mentions() ) { 247 return; 248 } 249 240 250 // If activity was marked as spam, stop the rest of this function. 241 251 if ( ! empty( $activity->is_spam ) ) … … 272 282 */ 273 283 function bp_activity_at_name_send_emails( $activity ) { 284 // Are mentions disabled? 285 if ( ! bp_activity_do_mentions() ) { 286 return; 287 } 288 274 289 // If our temporary variable doesn't exist, stop now. 275 290 if ( empty( buddypress()->activity->mentioned_users ) ) -
trunk/bp-activity/bp-activity-functions.php
r7115 r7193 26 26 27 27 return (bool) !empty( $bp->pages->activity->id ); 28 } 29 30 /** 31 * Are mentions enabled or disabled? 32 * 33 * The Mentions feature does a number of things, all of which will be turned 34 * off if you disable mentions: 35 * - Detecting and auto-linking @username in all BP/WP content 36 * - Sending BP notifications and emails to users when they are mentioned 37 * using the @username syntax 38 * - The Public Message button on user profiles 39 * 40 * Mentions are enabled by default. To disable, put the following line in 41 * bp-custom.php or your theme's functions.php file: 42 * 43 * add_filter( 'bp_activity_do_mentions', '__return_false' ); 44 * 45 * @since BuddyPress (1.8) 46 * 47 * @uses apply_filters() To call 'bp_activity_do_mentions' hook. 48 * @return bool $retval True to enable mentions, false to disable. 49 */ 50 function bp_activity_do_mentions() { 51 return (bool) apply_filters( 'bp_activity_do_mentions', true ); 28 52 } 29 53 -
trunk/bp-activity/bp-activity-loader.php
r6734 r7193 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 … … 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 … … 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 -
trunk/bp-activity/bp-activity-screens.php
r6596 r7193 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'; 270 271 if ( !$reply = bp_get_user_meta( bp_displayed_user_id(), 'notification_activity_new_reply', true ) ) 272 $reply = '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 } 272 } 273 274 if ( ! $reply = bp_get_user_meta( bp_displayed_user_id(), 'notification_activity_new_reply', true ) ) { 275 $reply = 'yes'; 276 } 277 278 ?> 273 279 274 280 <table class="notification-settings" id="activity-notification-settings"> … … 283 289 284 290 <tbody> 285 <tr id="activity-notification-settings-mentions"> 286 <td> </td> 287 <td><?php printf( __( 'A member mentions you in an update using "@%s"', 'buddypress' ), bp_core_get_username( bp_displayed_user_id() ) ) ?></td> 288 <td class="yes"><input type="radio" name="notifications[notification_activity_new_mention]" value="yes" <?php checked( $mention, 'yes', true ) ?>/></td> 289 <td class="no"><input type="radio" name="notifications[notification_activity_new_mention]" value="no" <?php checked( $mention, 'no', true ) ?>/></td> 290 </tr> 291 <?php if ( bp_activity_do_mentions() ) : ?> 292 <tr id="activity-notification-settings-mentions"> 293 <td> </td> 294 <td><?php printf( __( 'A member mentions you in an update using "@%s"', 'buddypress' ), bp_core_get_username( bp_displayed_user_id() ) ) ?></td> 295 <td class="yes"><input type="radio" name="notifications[notification_activity_new_mention]" value="yes" <?php checked( $mention, 'yes', true ) ?>/></td> 296 <td class="no"><input type="radio" name="notifications[notification_activity_new_mention]" value="no" <?php checked( $mention, 'no', true ) ?>/></td> 297 </tr> 298 <?php endif; ?> 299 291 300 <tr id="activity-notification-settings-replies"> 292 301 <td> </td> -
trunk/bp-activity/bp-activity-template.php
r7168 r7193 419 419 break; 420 420 case 'mentions': 421 422 // Are mentions disabled? 423 if ( ! bp_activity_do_mentions() ) { 424 return false; 425 } 421 426 422 427 // Start search at @ symbol and stop search at closing tag delimiter. … … 2799 2804 elseif ( 'favorites' == bp_current_action() ) 2800 2805 $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/favorites/feed/'; 2801 elseif ( 'mentions' == bp_current_action() )2806 elseif ( 'mentions' == bp_current_action() && bp_activity_do_mentions() ) 2802 2807 $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/mentions/feed/'; 2803 2808 else -
trunk/bp-templates/bp-legacy/buddypress-functions.php
r7151 r7193 100 100 101 101 // Activity button 102 if ( bp_is_active( 'activity' ) )102 if ( bp_is_active( 'activity' ) && bp_activity_do_mentions() ) 103 103 add_action( 'bp_member_header_actions', 'bp_send_public_message_button', 20 ); 104 104 -
trunk/bp-templates/bp-legacy/buddypress/activity/index.php
r7177 r7193 53 53 <?php endif; ?> 54 54 55 <?php do_action( 'bp_before_activity_type_tab_mentions' );?>55 <?php if ( bp_activity_do_mentions() ) : ?> 56 56 57 <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' ), number_format_i18n( bp_get_total_mention_count_for_user( bp_loggedin_user_id() )) ); ?></span></strong><?php endif; ?></a></li> 57 <?php do_action( 'bp_before_activity_type_tab_mentions' ); ?> 58 59 <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' ), number_format_i18n( bp_get_total_mention_count_for_user( bp_loggedin_user_id() )) ); ?></span></strong><?php endif; ?></a></li> 60 61 <?php endif; ?> 58 62 59 63 <?php endif; ?> -
trunk/bp-themes/bp-default/activity/index.php
r7004 r7193 73 73 <?php endif; ?> 74 74 75 <?php do_action( 'bp_before_activity_type_tab_mentions' );?>75 <?php if ( bp_activity_do_mentions() ) : ?> 76 76 77 <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> 77 <?php do_action( 'bp_before_activity_type_tab_mentions' ); ?> 78 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; ?> -
trunk/bp-themes/bp-default/functions.php
r7002 r7193 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
Note: See TracChangeset
for help on using the changeset viewer.