Changeset 11154
- Timestamp:
- 07/28/2021 08:01:26 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc/class-plugin.php
r11122 r11154 54 54 add_action( 'gp_translation_created', array( $this, 'auto_reject_replaced_suggestions' ) ); 55 55 56 add_filter( 'gp_for_translation_clauses', array( $this, 'allow_searching_for_no_author_translations' ), 10, 3 ); 57 56 58 // Cron. 57 59 add_filter( 'cron_schedules', [ $this, 'register_cron_schedules' ] ); … … 308 310 309 311 /** 312 * Allow searching for translations by user_id 0, by setting the user_login field to `0` or `anonymous`. 313 */ 314 function allow_searching_for_no_author_translations( $clauses, $set, $filters ) { 315 $user_login = gp_array_get( $filters, 'user_login' ); 316 317 if ( '0' === $user_login ) { 318 $clauses['where'] .= ( $clauses['where'] ? ' AND' : '' ) . ' t.user_id = 0'; 319 } elseif ( 'anonymous' === $user_login ) { 320 // 'Anonymous' user exists, but has no translations. 321 $clauses['where'] = preg_replace( '/(user_id\s*=\s*\d+)/', 'user_id = 0', $clauses['where'] ); 322 } 323 324 return $clauses; 325 } 326 327 /** 310 328 * Adds a link to view originals in consistency tool. 311 329 *
Note: See TracChangeset
for help on using the changeset viewer.