Ticket #5374: 5374.adminbar-bubble.diff
File 5374.adminbar-bubble.diff, 6.9 KB (added by , 11 years ago) |
---|
-
bp-core/css/admin-bar.css
diff --git bp-core/css/admin-bar.css bp-core/css/admin-bar.css index d3801dc..ff275af 100644
55 55 #wp-admin-bar-user-info img.avatar { 56 56 height: 64px; 57 57 width: 64px; 58 } 59 60 /** 61 * Signups "bubble" 62 */ 63 #wpadminbar #wp-admin-bar-bp-signups .ab-icon:before { 64 content: '\f110'; 65 top: 3px; 66 color:#d54e21; 58 67 } 68 No newline at end of file -
bp-core/css/admin-bar.min.css
diff --git bp-core/css/admin-bar.min.css bp-core/css/admin-bar.min.css index b20ce7e..ac15643 100644
1 #wpadminbar .quicklinks li#wp-admin-bar- user-admin-with-avatar>a img,#wpadminbar .quicklinks li#wp-admin-bar-group-admin-with-avatar>a img{width:16px;height:16px;display:inline;border:1px solid #999;vertical-align:middle;margin:-2px 10px 0 -5px;padding:0;background:#eee;float:none}#wpadminbar .quicklinks li#wp-admin-bar-group-admin-with-avatar ul{left:0}#wpadminbar .quicklinks li#wp-admin-bar-group-admin-with-avatar ul ul{left:0}#wpadminbar .quicklinks li#wp-admin-bar-my-account a span.count,#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar a span.count,#wpadminbar .quicklinks li#wp-admin-bar-bp-notifications #ab-pending-notifications{background:#21759b;color:#fff;text-shadow:none;display:inline;padding:2px 5px;font-size:10px;font-weight:bold;-moz-border-radius:10px;-khtml-border-radius:10px;-webkit-border-radius:10px;border-radius:10px}#wpadminbar .quicklinks li#wp-admin-bar-bp-notifications #ab-pending-notifications{background:#ddd;color:#333;margin:0}#wpadminbar .quicklinks li#wp-admin-bar-bp-notifications #ab-pending-notifications.alert{background-color:#1fb3dd;color:#fff}#wpadminbar .quicklinks li#wp-admin-bar-bp-notifications>a{padding:0 .5em}#wp-admin-bar-user-info img.avatar{height:64px;width:64px}2 No newline at end of file 1 #wpadminbar .quicklinks li#wp-admin-bar-group-admin-with-avatar>a img,#wpadminbar .quicklinks li#wp-admin-bar-user-admin-with-avatar>a img{width:16px;height:16px;display:inline;border:1px solid #999;vertical-align:middle;margin:-2px 10px 0 -5px;padding:0;background:#eee;float:none}#wpadminbar .quicklinks li#wp-admin-bar-group-admin-with-avatar ul,#wpadminbar .quicklinks li#wp-admin-bar-group-admin-with-avatar ul ul{left:0}#wpadminbar .quicklinks li#wp-admin-bar-bp-notifications #ab-pending-notifications,#wpadminbar .quicklinks li#wp-admin-bar-my-account a span.count,#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar a span.count{background:#21759B;color:#fff;text-shadow:none;display:inline;padding:2px 5px;font-size:10px;font-weight:700;-moz-border-radius:10px;-khtml-border-radius:10px;-webkit-border-radius:10px;border-radius:10px}#wpadminbar .quicklinks li#wp-admin-bar-bp-notifications #ab-pending-notifications{background:#ddd;color:#333;margin:0}#wpadminbar .quicklinks li#wp-admin-bar-bp-notifications #ab-pending-notifications.alert{background-color:#1fb3dd;color:#fff}#wpadminbar .quicklinks li#wp-admin-bar-bp-notifications>a{padding:0 .5em}#wp-admin-bar-user-info img.avatar{height:64px;width:64px}#wpadminbar #wp-admin-bar-bp-signups .ab-icon:before{content:'\f110';top:3px;color:#d54e21} 2 No newline at end of file -
bp-members/bp-members-admin.php
diff --git bp-members/bp-members-admin.php bp-members/bp-members-admin.php index 5db09be..eb8ad7f 100644
class BP_Members_Admin { 159 159 // Reorganise the views navigation in users.php and signups page 160 160 add_filter( "views_{$this->users_screen}", array( $this, 'signup_filter_view' ), 10, 1 ); 161 161 add_filter( 'set-screen-option', array( $this, 'signup_screen_options' ), 10, 3 ); 162 163 if ( get_current_blog_id() == bp_get_root_blog_id() ) { 164 add_action( 'bp_admin_init', array( $this, 'signup_check_new' ) ); 165 } 166 162 167 } 163 168 } 164 169 … … class BP_Members_Admin { 1030 1035 // Prepare notices for admin 1031 1036 $notice = array(); 1032 1037 1038 if ( ! array_diff( array_keys( $_REQUEST ), array( 'page' ) ) && ! get_transient( '_bp_signup_checked' ) ) { 1039 // Next check will happen in 6 hours & will check new signups till now 1040 set_transient ( '_bp_signup_checked', 1, 6 * HOUR_IN_SECONDS ); 1041 bp_update_option( '_bp_signup_last_registered', current_time( 'mysql', true ) ); 1042 } 1043 1033 1044 if ( ! empty( $_REQUEST['updated'] ) ) { 1034 1045 switch ( $_REQUEST['updated'] ) { 1035 1046 case 'resent': … … class BP_Members_Admin { 1381 1392 1382 1393 <?php 1383 1394 } 1395 1396 /** 1397 * Checks every 6 hours to see if new signups were created 1398 * 1399 * @since BuddyPress (2.0.0) 1400 */ 1401 public function signup_check_new() { 1402 1403 if ( ! current_user_can( 'create_users' ) ) 1404 return; 1405 1406 $check = get_transient( '_bp_signup_checked' ); 1407 1408 if ( ! empty( $check ) ) 1409 return; 1410 1411 $last_registered_date = bp_get_option( '_bp_signup_last_registered', current_time( 'mysql', true ) ); 1412 1413 $this->signup_count = BP_Signup::count_signups( $last_registered_date ); 1414 1415 if ( ! empty( $this->signup_count ) ) { 1416 // After comments but before new content 1417 add_action( 'admin_bar_menu', array( $this, 'admin_bar_bubble' ), 65 ); 1418 } 1419 } 1420 1421 /** 1422 * Adds a bubble to inform about the "latest" new signups 1423 * 1424 * @since BuddyPress (2.0.0) 1425 * 1426 * @param WP_Admin_Bar $wp_admin_bar 1427 */ 1428 function admin_bar_bubble( $wp_admin_bar = null ) { 1429 if ( ! current_user_can( 'bp_moderate' ) ) 1430 return; 1431 1432 $pending_title = esc_attr( sprintf( _n( '%s new sign-up', '%s new sign-ups', $this->signup_count ), number_format_i18n( $this->signup_count ) ) ); 1433 1434 $icon = '<span class="ab-icon"></span>'; 1435 $title = '<span id="ab-pending-accounts" class="ab-label pending-accounts pending-count count-' . $this->signup_count . '">' . number_format_i18n( $this->signup_count ) . '</span>'; 1436 $url = add_query_arg( 'page', 'bp-signups', bp_get_admin_url( 'users.php' ) ); 1437 1438 $wp_admin_bar->add_menu( array( 1439 'id' => 'bp-signups', 1440 'title' => $icon . $title, 1441 'href' => $url, 1442 'meta' => array( 'title' => $pending_title ), 1443 ) ); 1444 } 1384 1445 } 1385 1446 endif; // class_exists check 1386 1447 -
bp-members/bp-members-classes.php
diff --git bp-members/bp-members-classes.php bp-members/bp-members-classes.php index 0554bab..51cc43c 100644
class BP_Signup { 407 407 * 408 408 * @return int the number of signups 409 409 */ 410 public static function count_signups( ) {410 public static function count_signups( $date_offset = '' ) { 411 411 global $wpdb; 412 412 413 413 $signups_table = buddypress()->members->table_name_signups; 414 $count_signups = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) AS total FROM {$signups_table} WHERE active = %d", 0 ) ); 414 415 $sql = "SELECT COUNT(*) AS total FROM {$signups_table} WHERE active = 0"; 416 417 if ( ! empty( $date_offset ) ) 418 $sql = $wpdb->prepare( $sql . " AND registered >= %s" , $date_offset ); 419 420 421 $count_signups = $wpdb->get_var( $sql ); 415 422 416 423 return apply_filters( 'bp_core_signups_count', (int) $count_signups ); 417 424 }