public function do_ping_check($user_id = false) { require_once dirname(__FILE__) . '/server.php'; if (empty($user_id)) { $user_id = current(array_keys($this->options['authentications'])); } $authentication = $this->get_authentication_details($user_id); if (empty($authentication)) { return new WP_Error('ithemes-sync-invalid-user', __('A valid user was unable to be found. A valid user is required in order to do a successful ping.', 'it-l10n-ithemes-sync')); } $result = Ithemes_Sync_Server::validate($user_id, $authentication['username'], $authentication['key']); if (is_wp_error($result) || !is_array($result) || !isset($result['success']) || !$result['success']) { return false; } return true; }