Skip to content

Commit

Permalink
Allow doaction.org URLs for events
Browse files Browse the repository at this point in the history
  • Loading branch information
dd32 authored Jul 25, 2024
1 parent 2ecbc65 commit ff7727d
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ public function render_site_url_field( $key, $field_type, $object_name ) {
$valid_url = isset( $url['host'], $url['path'] );
$tld = get_top_level_domain();
$network_id = $valid_url && "events.wordpress.$tld" === $url['host'] ? EVENTS_NETWORK_ID : WORDCAMP_NETWORK_ID;
$doaction = ( 'doaction.org' === $url['host'] );
?>

<?php if ( $valid_url && domain_exists( $url['host'], $url['path'], $network_id ) ) : ?>
<?php if ( $valid_url && ! $doaction && domain_exists( $url['host'], $url['path'], $network_id ) ) : ?>
<?php
$blog_details = get_blog_details(
array(
Expand All @@ -75,7 +76,7 @@ public function render_site_url_field( $key, $field_type, $object_name ) {
<a target="_blank" href="<?php echo esc_url( $blog_details->siteurl ); ?>/wp-admin/">Dashboard</a> |
<a target="_blank" href="<?php echo esc_url( $blog_details->siteurl ); ?>">Visit</a>

<?php else : ?>
<?php else if ( ! $doaction ) : ?>
<?php $checkbox_id = wcpt_key_to_str( 'create-site-in-network', 'wcpt_' ); ?>

<label for="<?php echo esc_attr( $checkbox_id ); ?>">
Expand Down Expand Up @@ -170,6 +171,11 @@ public static function url_matches_expected_format( $domain, $path, $wordcamp_id
$is_external_domain = ! preg_match( "@ \.wordcamp\.$tld | \.buddycamp\.$tld | events\.wordpress\.$tld @ix", $domain );
$can_have_external_domain = $wordcamp_id <= $last_permitted_external_domain || in_array( $wordcamp_id, $external_domain_exceptions );

// DoAction is not hosted within the WordCamp infrastructure, so we don't need to validate it.
if ( 'doaction.org' === $domain ) {
return true;
}

if ( $is_external_domain && $can_have_external_domain ) {
// Many old camps had external websites.
return true;
Expand Down

0 comments on commit ff7727d

Please sign in to comment.