Ticket #3388: 3388.002.diff
File 3388.002.diff, 14.6 KB (added by , 14 years ago) |
---|
-
bp-themes/bp-default/activity/index.php
72 72 73 73 <?php do_action( 'bp_before_activity_type_tab_mentions' ) ?> 74 74 75 < 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( 'Public Mentions', 'buddypress' ); ?><?php if ( bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) : ?> <strong><?php printf( __( '<span>%s new</span>', 'buddypress' ), bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) ?></strong><?php endif; ?></a></li>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( 'Public Mentions', 'buddypress' ); ?><?php if ( bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) : ?> <strong><?php printf( __( '<span>%s new</span>', 'buddypress' ), bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) ?></strong><?php endif; ?></a></li> 78 79 <?php endif; ?> 80 77 81 <?php endif; ?> 78 82 79 83 <?php do_action( 'bp_activity_type_tabs' ) ?> … … 87 91 <?php do_action( 'bp_activity_syndication_options' ) ?> 88 92 89 93 <li id="activity-filter-select" class="last"> 90 <label for="activity-filter-by"><?php _e( 'Show:', 'buddypress' ); ?></label> 94 <label for="activity-filter-by"><?php _e( 'Show:', 'buddypress' ); ?></label> 91 95 <select id="activity-filter-by"> 92 96 <option value="-1"><?php _e( 'Everything', 'buddypress' ) ?></option> 93 97 <option value="activity_update"><?php _e( 'Updates', 'buddypress' ) ?></option> -
bp-themes/bp-default/functions.php
104 104 add_action( 'bp_member_header_actions', 'bp_add_friend_button' ); 105 105 106 106 // Activity button 107 if ( bp_is_active( 'activity' ) )107 if ( bp_is_active( 'activity' ) && bp_activity_do_mentions() ) 108 108 add_action( 'bp_member_header_actions', 'bp_send_public_message_button' ); 109 109 110 110 // Messages button -
bp-core/admin/bp-core-admin.php
18 18 * @package BuddyPress Core 19 19 * @since {@internal Unknown}} 20 20 */ 21 function bp_core_admin_dashboard() { 21 function bp_core_admin_dashboard() { 22 22 $base_url = bp_get_admin_url( 'admin.php' ); 23 23 $action = add_query_arg( array( 'page' => 'bp-general-settings' ), $base_url ); 24 24 ?> … … 136 136 </td> 137 137 </tr> 138 138 139 <tr> 140 <th scope="row"><?php _e( 'Disable activity @mentions?', 'buddypress' ) ?>:</th> 141 <td> 142 <input type="radio" name="bp-admin[bp_disable_mentions]"<?php checked( '1', bp_get_option( 'bp_disable_mentions', '0' ) ); ?>id="bp_disable_mentions" value="1" /> <?php _e( 'Yes', 'buddypress' ) ?> 143 <input type="radio" name="bp-admin[bp_disable_mentions]"<?php checked( '0', bp_get_option( 'bp_disable_mentions', '0' ) ); ?>id="bp_disable_mentions" value="0" /> <?php _e( 'No', 'buddypress' ) ?> 144 </td> 145 </tr> 146 139 147 <?php endif; ?> 140 148 141 149 <?php if ( bp_is_active( 'groups' ) ) : ?> … … 330 338 */ 331 339 function bp_core_admin_component_options() { 332 340 global $bp_wizard; 333 341 334 342 // Load core functions, if needed 335 343 if ( !function_exists( 'bp_get_option' ) ) 336 344 require( BP_PLUGIN_DIR . '/bp-core/bp-core-functions.php' ); 337 345 338 346 $active_components = apply_filters( 'bp_active_components', bp_get_option( 'bp-active-components' ) ); 339 347 340 348 // An array of strings looped over to create component setup markup 341 349 $optional_components = apply_filters( 'bp_admin_optional_components', array( 342 350 'xprofile' => array( … … 387 395 'description' => __( 'Everything in a BuddyPress community revolves around its members.', 'buddypress' ) 388 396 ), 389 397 ) ); 390 398 391 399 // On new install, set all components to be active by default 392 400 if ( !empty( $bp_wizard ) && 'install' == $bp_wizard->setup_type && empty( $active_components ) ) 393 401 $active_components = $optional_components; 394 402 395 403 ?> 396 404 397 405 <?php /* The setup wizard uses different, more descriptive text here */ ?> 398 406 <?php if ( empty( $bp_wizard ) ) : ?> 399 407 400 408 <h3><?php _e( 'Available Components', 'buddypress' ); ?></h3> 401 409 402 410 <p><?php _e( 'Each component has a unique purpose, and your community may not need each one.', 'buddypress' ); ?></p> 403 411 404 412 <?php endif ?> 405 413 406 414 <table class="form-table"> 407 415 <tbody> 408 416 … … 479 487 */ 480 488 function bp_core_admin_page_options() { 481 489 global $bp; 482 490 483 491 // Get the existing WP pages 484 492 $existing_pages = bp_core_get_page_meta(); 485 493 … … 493 501 494 502 if ( is_multisite() ) 495 503 $directory_pages['blogs'] = __( "Site Directory", 'buddypress' ); ?> 496 504 497 505 <h3><?php _e( 'Directories', 'buddypress' ); ?></h3> 498 506 499 507 <p><?php _e( 'Choose a WordPress Page to associate with each available BuddyPress Component directory.', 'buddypress' ); ?></p> 500 508 501 509 <table class="form-table"> … … 503 511 504 512 <?php foreach ( $directory_pages as $name => $label ) : ?> 505 513 <?php $disabled = !bp_is_active( $name ) ? ' disabled="disabled"' : ''; ?> 506 514 507 515 <tr valign="top"> 508 516 <th scope="row"> 509 517 <label for="bp_pages[<?php echo esc_attr( $name ) ?>]"><?php echo esc_html( $label ) ?><?php if ( !bp_is_active( $name ) ) : ?> <span class="description">(deactivated)</span><?php endif ?></label> 510 518 </th> 511 519 512 520 <td> 513 <?php if ( !bp_is_root_blog() ) 521 <?php if ( !bp_is_root_blog() ) 514 522 switch_to_blog( bp_get_root_blog_id() ) ?> 515 523 516 524 <?php echo wp_dropdown_pages( array( 517 525 'name' => 'bp_pages[' . esc_attr( $name ) . ']', 518 526 'echo' => false, … … 528 536 <a href="<?php echo get_permalink( $existing_pages[$name] ); ?>" class="button-secondary" target="_bp"><?php _e( 'View' ); ?></a> 529 537 530 538 <?php endif; ?> 531 532 <?php if ( !bp_is_root_blog() ) 539 540 <?php if ( !bp_is_root_blog() ) 533 541 restore_current_blog() ?> 534 542 535 543 </td> … … 542 550 543 551 </tbody> 544 552 </table> 545 553 546 554 <?php 547 555 548 556 // Static pages -
bp-activity/bp-activity-actions.php
297 297 function bp_activity_action_mentions_feed() { 298 298 global $bp, $wp_query; 299 299 300 if ( !bp_ is_current_component( 'activity' ) || !bp_is_user() || !bp_is_current_action( 'mentions' ) || !bp_is_action_variable( 'feed', 0 ) )300 if ( !bp_activity_do_mentions() || !bp_is_current_component( 'activity' ) || !bp_is_user() || !bp_is_current_action( 'mentions' ) || !bp_is_action_variable( 'feed', 0 ) ) 301 301 return false; 302 302 303 303 $wp_query->is_404 = false; -
bp-activity/bp-activity-screens.php
78 78 * @uses bp_activity_clear_new_mentions() 79 79 * @uses bp_is_my_profile() 80 80 */ 81 function bp_activity_reset_my_new_mentions() { 81 function bp_activity_reset_my_new_mentions() { 82 82 if ( bp_is_my_profile() ) 83 83 bp_activity_clear_new_mentions( bp_loggedin_user_id() ); 84 84 } … … 90 90 // No displayed user or not viewing activity component 91 91 if ( !bp_is_activity_component() ) 92 92 return false; 93 94 if ( empty( $bp->current_action ) || !is_numeric( $bp->current_action ) ) 95 return false; 96 93 94 if ( empty( $bp->current_action ) || !is_numeric( $bp->current_action ) ) 95 return false; 96 97 97 // Get the activity details 98 98 $activity = bp_activity_get_specific( array( 'activity_ids' => bp_current_action(), 'show_hidden' => true ) ); 99 99 … … 158 158 function bp_activity_screen_notification_settings() { 159 159 global $bp; 160 160 161 if ( !$mention = bp_get_user_meta( $bp->displayed_user->id, 'notification_activity_new_mention', true ) ) 162 $mention = 'yes'; 161 if ( bp_activity_do_mentions() ) 162 if ( !$mention = bp_get_user_meta( $bp->displayed_user->id, 'notification_activity_new_mention', true ) ) 163 $mention = 'yes'; 163 164 164 165 if ( !$reply = bp_get_user_meta( $bp->displayed_user->id, 'notification_activity_new_reply', true ) ) 165 166 $reply = 'yes'; ?> … … 175 176 </thead> 176 177 177 178 <tbody> 179 <?php if ( bp_activity_do_mentions() ) : ?> 178 180 <tr id="activity-notification-settings-mentions"> 179 181 <td> </td> 180 182 <td><?php printf( __( 'A member mentions you in an update using "@%s"', 'buddypress' ), bp_core_get_username( $bp->displayed_user->id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login ) ) ?></td> 181 183 <td class="yes"><input type="radio" name="notifications[notification_activity_new_mention]" value="yes" <?php checked( $mention, 'yes', true ) ?>/></td> 182 184 <td class="no"><input type="radio" name="notifications[notification_activity_new_mention]" value="no" <?php checked( $mention, 'no', true ) ?>/></td> 183 185 </tr> 186 <?php endif; ?> 184 187 <tr id="activity-notification-settings-replies"> 185 188 <td> </td> 186 189 <td><?php _e( "A member replies to an update or comment you've posted", 'buddypress' ) ?></td> -
bp-activity/bp-activity-loader.php
128 128 ); 129 129 130 130 // @ mentions 131 $sub_nav[] = array( 132 'name' => __( 'Mentions', 'buddypress' ), 133 'slug' => 'mentions', 134 'parent_url' => $activity_link, 135 'parent_slug' => $this->slug, 136 'screen_function' => 'bp_activity_screen_mentions', 137 'position' => 20, 138 'item_css_id' => 'activity-mentions' 139 ); 131 if ( bp_activity_do_mentions() ) { 132 $sub_nav[] = array( 133 'name' => __( 'Mentions', 'buddypress' ), 134 'slug' => 'mentions', 135 'parent_url' => $activity_link, 136 'parent_slug' => $this->slug, 137 'screen_function' => 'bp_activity_screen_mentions', 138 'position' => 20, 139 'item_css_id' => 'activity-mentions' 140 ); 141 } 140 142 141 143 // Favorite activity items 142 144 $sub_nav[] = array( … … 212 214 ); 213 215 214 216 // Mentions 215 $wp_admin_nav[] = array( 216 'parent' => 'my-account-' . $this->id, 217 'title' => $title, 218 'href' => trailingslashit( $activity_link . 'mentions' ) 219 ); 217 if ( bp_activity_do_mentions() ) { 218 $wp_admin_nav[] = array( 219 'parent' => 'my-account-' . $this->id, 220 'title' => $title, 221 'href' => trailingslashit( $activity_link . 'mentions' ) 222 ); 223 } 220 224 221 225 // Personal 222 226 $wp_admin_nav[] = array( -
bp-activity/bp-activity-filters.php
73 73 add_filter( 'bp_get_activity_latest_update_excerpt', 'bp_activity_make_nofollow_filter' ); 74 74 add_filter( 'bp_get_activity_feed_item_description', 'bp_activity_make_nofollow_filter' ); 75 75 76 add_filter( 'pre_comment_content', 'bp_activity_at_name_filter' ); 77 add_filter( 'group_forum_topic_text_before_save', 'bp_activity_at_name_filter' ); 78 add_filter( 'group_forum_post_text_before_save', 'bp_activity_at_name_filter' ); 76 if ( bp_activity_do_mentions() ) { 77 add_filter( 'pre_comment_content', 'bp_activity_at_name_filter' ); 78 add_filter( 'group_forum_topic_text_before_save', 'bp_activity_at_name_filter' ); 79 add_filter( 'group_forum_post_text_before_save', 'bp_activity_at_name_filter' ); 80 } 79 81 80 82 add_filter( 'bp_get_activity_parent_content', 'bp_create_excerpt' ); 81 83 … … 112 114 * @package BuddyPress Activity 113 115 * 114 116 * @param string $content The activity content 115 * @param int $activity_id When $adjust_mention_count is true, you must provide an $activity_id, 117 * @param int $activity_id When $adjust_mention_count is true, you must provide an $activity_id, 116 118 * which will be added to the list of the user's unread mentions 117 119 */ 118 120 function bp_activity_at_name_filter( $content, $activity_id = 0 ) { … … 135 137 $content = preg_replace( '/(@' . $username . '\b)/', "<a href='" . bp_core_get_user_domain( $user_id ) . "' rel='nofollow'>@$username</a>", $content ); 136 138 } 137 139 138 // Adjust the activity count for this item 140 // Adjust the activity count for this item 139 141 if ( $activity_id ) 140 142 bp_activity_adjust_mention_count( $activity_id, 'add' ); 141 143 142 144 return $content; 143 } 145 } 144 146 145 147 /** 146 148 * Catch mentions in saved activity items … … 153 155 function bp_activity_at_name_filter_updates( $activity ) { 154 156 // Only run this function once for a given activity item 155 157 remove_filter( 'bp_activity_after_save', 'bp_activity_at_name_filter_updates' ); 156 158 157 159 // Run the content through the linking filter, making sure to increment mention count 158 160 $activity->content = bp_activity_at_name_filter( $activity->content, $activity->id ); 159 161 160 162 // Resave the activity with the new content 161 163 $activity->save(); 162 164 } 163 add_filter( 'bp_activity_after_save', 'bp_activity_at_name_filter_updates' ); 165 if ( bp_activity_do_mentions() ) 166 add_filter( 'bp_activity_after_save', 'bp_activity_at_name_filter_updates' ); 164 167 165 168 function bp_activity_make_nofollow_filter( $text ) { 166 169 return preg_replace_callback( '|<a (.+?)>|i', 'bp_activity_make_nofollow_filter_callback', $text ); … … 198 201 return apply_filters( 'bp_activity_truncate_entry', $excerpt, $text, $append_text ); 199 202 } 200 203 add_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 ); 201 add_filter( 'bp_get_activity_content', 'bp_activity_truncate_entry', 5 ); 204 add_filter( 'bp_get_activity_content', 'bp_activity_truncate_entry', 5 ); 205 206 /** 207 * Are mentions enabled or disabled? 208 * 209 * @package BuddyPress Activity 210 * @since 1.3 211 * 212 * @uses apply_filters() To call 'bp_activity_do_mentions' hook. 213 * @return bool $retval True to enable mentions, false to disable. Defaults to true. 214 */ 215 function bp_activity_do_mentions() { 216 // Default to true 217 $retval = true; 218 219 // Get @mentions option, default to 0 (use them) 220 $disabled = (int) bp_get_option( 'bp_disable_mentions', 0 ); 221 222 // Turn them off? 223 if ( $disabled ) 224 $retval = false; 225 226 return apply_filters( 'bp_activity_do_mentions', $retval ); 227 } 228 202 229 ?> 230 No newline at end of file