Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow skipping validation on URL #1413

Merged
merged 2 commits into from
Oct 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,23 @@ protected function get_cache_expiration() {
return $this->range->generate_cache_duration( parent::get_cache_expiration() );
}

/**
* Simple method to check against URL field
*
* @param int $wordcamp_id ID for the wordcamp post type.
*
* @return bool
*/
public function is_a_wordcamp_url( $wordcamp_id ) {
$url = get_post_meta( $wordcamp_id, 'URL', true );

// doaction sites are tracked but break the validate wordcamp site check.
if ( false !== strpos( $url, 'doaction' ) ) {
return false;
}
return true;
}

/**
* Query and parse the data for the report.
*
Expand Down Expand Up @@ -246,6 +263,9 @@ public function get_data() {

foreach ( $wordcamp_ids as $wordcamp_id ) {
try {
if ( ! $this->is_a_wordcamp_url( $wordcamp_id ) ) {
continue;
}
$valid = validate_wordcamp_id( $wordcamp_id );

$data = array_merge( $data, $this->get_data_for_site( $valid->site_id, $valid->post_id ) );
Expand Down
Loading