Skip to content

Commit

Permalink
Allow doaction.org URLs for events (#1350)
Browse files Browse the repository at this point in the history
* Allow doaction.org URLs for events

---------

Co-authored-by: Paul Kevan <[email protected]>
Co-authored-by: ren <[email protected]>
  • Loading branch information
3 people authored Aug 26, 2024
1 parent 12e044f commit 6f5ef74
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;
$we_host_it = $valid_url && 'doaction.org' !== $url['host'];
?>

<?php if ( $valid_url && domain_exists( $url['host'], $url['path'], $network_id ) ) : ?>
<?php if ( $valid_url && $we_host_it && 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 elseif ( $we_host_it ) : ?>
<?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 can have an external domain.
if ( 'doaction.org' === $domain ) {
$can_have_external_domain = true;
}

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

0 comments on commit 6f5ef74

Please sign in to comment.