diff --git a/public_html/wp-content/mu-plugins/3-helpers-misc.php b/public_html/wp-content/mu-plugins/3-helpers-misc.php index 662bd494c..e675a4983 100644 --- a/public_html/wp-content/mu-plugins/3-helpers-misc.php +++ b/public_html/wp-content/mu-plugins/3-helpers-misc.php @@ -2,6 +2,7 @@ defined( 'WPINC' ) || die(); use function WordCamp\Logger\log; +use function WordCamp\Sunrise\get_top_level_domain; /* * Miscellaneous helper functions. @@ -25,6 +26,19 @@ function is_wordcamp_type( $type ) { } } +/** + * Return whether the url is for a Next-Gen site. + * + * @param string $url The Url to test. + * + * @return bool Returns true if the url matches events url structure. + */ +function is_event_url( $url ) { + $url = wp_parse_url( filter_var( $url, FILTER_VALIDATE_URL ) ); + $tld = get_top_level_domain(); + return "events.wordpress.$tld" === $url['host']; +} + /** * Get the current environment. * diff --git a/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-admin.php b/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-admin.php index 48d4dbc56..37ecd14d2 100644 --- a/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-admin.php +++ b/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-admin.php @@ -773,14 +773,15 @@ public static function notify_new_wordcamp_in_slack( $wordcamp ) { } // Not translating any string because they will be sent to slack. - $city = get_post_meta( $wordcamp->ID, 'Location', true ); $start_date = get_post_meta( $wordcamp->ID, 'Start Date (YYYY-mm-dd)', true ); $wordcamp_url = get_post_meta( $wordcamp->ID, 'URL', true ); - $title = 'New WordCamp scheduled!!!'; + $is_event = is_event_url( $wordcamp_url ); + $title = sprintf( 'New %s scheduled!!!', $is_event ? 'Next Generation Event' : 'WordCamp' ); $message = sprintf( - "<%s|WordCamp $city> has been scheduled for a start date of %s. :tada: :community: :WordPress:\n\n%s", + "<%s|%s> has been scheduled for a start date of %s. :tada: :community: :WordPress:\n\n%s", $wordcamp_url, + $wordcamp->post_title, gmdate( 'F j, Y', $start_date ), $wordcamp_url );