Tribe__Admin__Notice__Marketing::black_friday_should_display()

Whether the Black Friday notice should display.

Unix times for Monday of Thanksgiving week @ 6am UTC and Dec 1 2020 @ 6am UTC. 6am UTC is midnight for TheEventsCalendar.com, which uses the America/Los_Angeles time zone.


Return

(boolean)


Top ↑

Source

File: src/Tribe/Admin/Notice/Marketing.php

	public function black_friday_should_display() {
		// If upsells have been manually hidden, respect that.
		if ( defined( 'TRIBE_HIDE_UPSELL' ) && TRIBE_HIDE_UPSELL ) {
			return false;
		}

		$now           = Dates::build_date_object( 'now', 'UTC' )->format( 'U' );
		$bf_sale_start = $this->get_black_friday_start_time();
		$bf_sale_end   = $this->get_black_friday_end_time();

		$current_screen = get_current_screen();

		$screens = [
			'tribe_events_page_tribe-app-shop', // App shop.
			'events_page_tribe-app-shop', // App shop.
			'tribe_events_page_tribe-common', // Settings & Welcome.
			'events_page_tribe-common', // Settings & Welcome.
			'toplevel_page_tribe-common', // Settings & Welcome.
		];

		// If not a valid screen, don't display.
		if ( empty( $current_screen->id ) || ! in_array( $current_screen->id, $screens, true ) ) {
			return false;
		}

		return $bf_sale_start <= $now && $now < $bf_sale_end;
	}

Top ↑

Changelog

Changelog
Version Description
4.12.14 Introduced.