Changeset 9168
- Timestamp:
- 10/09/2019 07:37:45 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/functions.php
r9167 r9168 349 349 return $cache[ $cache_key ]; 350 350 } 351 352 /** 353 * Schedule a cron-task to clear pending registrations regularly. 354 */ 355 function wporg_login_cron_tasks() { 356 if ( ! wp_next_scheduled( 'login_purge_pending_registrations' ) ) { 357 wp_schedule_event( time(), 'daily', 'login_purge_pending_registrations' ); 358 } 359 } 360 add_action( 'admin_init', 'wporg_login_cron_tasks' ); 361 362 /** 363 * Clears the Pending Registrations table reguarly. 364 */ 365 function wporg_login_purge_pending_registrations() { 366 global $wpdb; 367 $two_weeks_ago = gmdate( 'Y-m-d H:i:s', time() - 14 * DAY_IN_SECONDS ); 368 369 $wpdb->query( $wpdb->prepare( 370 "DELETE FROM `{$wpdb->base_prefix}user_pending_registrations` WHERE `user_registered` <= %s", 371 $two_weeks_ago 372 ) ); 373 } 374 add_action( 'login_purge_pending_registrations', 'wporg_login_purge_pending_registrations' );
Note: See TracChangeset
for help on using the changeset viewer.