diff --git a/includes/class-admin.php b/includes/class-admin.php index ed5518cc..2f86668a 100644 --- a/includes/class-admin.php +++ b/includes/class-admin.php @@ -3447,6 +3447,10 @@ public function site_status_tests( $tests ) { 'label' => __( 'Friend roles were created', 'friends' ), 'test' => array( $this, 'friend_roles_test' ), ); + $tests['direct']['friends-cron'] = array( + 'label' => __( 'Friend cron job is enabled', 'friends' ), + 'test' => array( $this, 'friends_cron_test' ), + ); return $tests; } @@ -3513,6 +3517,39 @@ public function friend_roles_test() { return $result; } + public function friends_cron_test() { + $result = array( + 'label' => __( 'The friend cron job is enabled', 'friends' ), + 'status' => 'good', + 'badge' => array( + 'label' => __( 'Friends', 'friends' ), + 'color' => 'green', + ), + 'description' => + '

' . + __( 'The Friends Plugin uses a cron job to fetch your friends\' feeds.', 'friends' ) . + '

', + 'test' => 'friends-cron', + ); + + if ( ! wp_next_scheduled( 'cron_friends_refresh_feeds' ) ) { + $result['label'] = __( 'The friends cron job is not enabled', 'friends' ); + $result['badge']['color'] = 'red'; + $result['status'] = 'critical'; + $result['description'] .= '

'; + $result['description'] .= wp_kses_post( + sprintf( + // translators: %s is a URL. + __( 'To fix this: Enable the Friends cron job.', 'friends' ), + esc_url( wp_nonce_url( add_query_arg( '_wp_http_referer', remove_query_arg( '_wp_http_referer' ), self_admin_url( 'admin.php?page=friends-settings&rerun-activate' ) ), 'friends-settings' ) ) + ) + ); + $result['description'] .= '

'; + } + + return $result; + } + public function site_status_test_php_modules( $modules ) { $modules['mbstring']['required'] = true; return $modules;