Changeset 1182
- Timestamp:
- 01/23/2015 09:45:46 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/api.wordpress.org/public_html/dotorg/trac/mentions-handler.php
r1181 r1182 23 23 $user = get_user_by( 'login', $user_login ); 24 24 25 if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM trac_users WHERE user_login = %s", $user_login ) ) ) { 25 function wporg_user_has_visited_trac( $user_login ) { 26 global $wpdb; 27 return (bool) $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM trac_users WHERE user_login = %s", $user_login ) ); 28 } 29 30 if ( ! wporg_user_has_visited_trac( $user_login ) ) { 26 31 $wpdb->insert( 'trac_users', compact( 'user_login' ) ); 27 32 } 33 34 add_filter( 'wporg_notifications_notify_username', function( $notify, $username ) use ( $type, $payload, $wpdb ) { 35 if ( $type === 'ticket' ) { 36 // Don't need a query to say we can notify the owner and reporter. 37 if ( $username === $payload->owner || $username === $payload->reporter ) { 38 return true; 39 } 40 } 41 42 if ( wporg_user_has_visited_trac( $username ) ) { 43 return true; 44 } 45 return $notify; 46 }, 10, 2 ); 28 47 29 48 $notif->match_notify( array(
Note: See TracChangeset
for help on using the changeset viewer.