Changeset 2114 for sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-custom-stats/stats/user.php
- Timestamp:
- 11/22/2015 10:30:57 PM (9 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-custom-stats
- Files:
-
- 2 added
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-custom-stats/stats/user.php
r2102 r2114 8 8 * @author dd32 9 9 */ 10 class GP_WPorg_User_Stats extends GP_Plugin { 11 var $id = 'wporg-user-stats'; 10 class WPorg_GP_User_Stats { 12 11 13 12 function __construct() { 14 global $ gpdb;13 global $wpdb, $gp_table_prefix; 15 14 16 parent::__construct(); 17 $this->add_action( 'translation_created' ); 18 $this->add_action( 'translation_saved' ); 15 add_action( 'translation_created', array( $this, 'translation_created' ) ); 16 add_action( 'translation_saved', array( $this, 'translation_saved' ) ); 19 17 20 $ gpdb->user_translations_count = $gpdb->prefix . 'user_translations_count';18 $wpdb->user_translations_count = $gp_table_prefix . 'user_translations_count'; 21 19 } 22 20 … … 45 43 46 44 } 47 48 45 } 49 46 50 47 function bump_user_stat( $user_id, $locale, $locale_slug, $suggested = 0, $accepted = 0 ) { 51 global $ gpdb;52 $ gpdb->query( $gpdb->prepare(53 "INSERT INTO {$ gpdb->user_translations_count} (`user_id`, `locale`, `locale_slug`, `suggested`, `accepted`) VALUES (%d, %s, %s, %d, %d)48 global $wpdb; 49 $wpdb->query( $wpdb->prepare( 50 "INSERT INTO {$wpdb->user_translations_count} (`user_id`, `locale`, `locale_slug`, `suggested`, `accepted`) VALUES (%d, %s, %s, %d, %d) 54 51 ON DUPLICATE KEY UPDATE `suggested`=`suggested` + VALUES(`suggested`), `accepted`=`accepted` + VALUES(`accepted`)", 55 52 $user_id, $locale, $locale_slug, $suggested, $accepted … … 58 55 59 56 } 60 GP::$plugins->wporg_user_stats = new GP_WPorg_User_Stats;61 57 62 58 /*
Note: See TracChangeset
for help on using the changeset viewer.