Skip to content

Commit

Permalink
put notices back, but change to ETP, not ETWP
Browse files Browse the repository at this point in the history
  • Loading branch information
codingmusician committed Jul 25, 2024
1 parent 8cc4f93 commit 5f625fb
Showing 1 changed file with 56 additions and 9 deletions.
65 changes: 56 additions & 9 deletions src/Tickets/Admin/Upsell.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class Upsell {
* Method to register Upsell-related hooks.
*
* @since 5.3.4
* @since TBD Remove emails settings filter.
*/
public function hooks() {
add_action( 'tribe_events_tickets_pre_edit', [ $this, 'maybe_show_capacity_arf' ] );
Expand All @@ -31,6 +30,8 @@ public function hooks() {
$this,
'render_ticket_type_upsell_notice'
], 20, 3 );

add_filter( 'tec_tickets_emails_settings_template_list', [ $this, 'show_on_emails_settings_page' ] );
}

/**
Expand Down Expand Up @@ -68,7 +69,6 @@ public function maybe_show_capacity_arf() {
* Show upsell on Attendees page.
*
* @since 5.7.1
* @since TBD Remove wallet plus notice.
*
* @return void
*/
Expand All @@ -80,11 +80,17 @@ public function show_on_attendees_page() {

$has_tickets_plus = class_exists( '\Tribe__Tickets_Plus__Main', false );

// If Tickets Plus is installed, then bail.
// If both Tickets Plus and Wallet Plus are installed, then bail.
if ( $has_tickets_plus ) {
return;
}

// 50% chance of showing either upsell.
if ( wp_rand( 0, 1 ) ) {
$this->show_wallet_plus();
return;
}

$this->maybe_show_manual_attendees();
}

Expand Down Expand Up @@ -123,14 +129,31 @@ public function maybe_show_manual_attendees() {
/**
* Maybe show upsell for Wallet Plus.
*
* @deprecated TBD
*
* @since 5.7.1
*
* @return void
*/
public function show_wallet_plus() {
_deprecated_function( __METHOD__, 'TBD', '' );

echo '<div class="welcome-panel-column welcome-panel-extra">';
tribe( Upsell_Notice\Main::class )->render( [
'classes' => [
'tec-admin__upsell-tec-tickets-wallet-plus'
],
'text' => sprintf(
// Translators: %s: Link to "Wallet Plus" plugin.
esc_html__( 'Get additional ticketing flexibility including Apple Wallet and PDF tickets with %s' , 'event-tickets' ),
''
),
'link' => [
'classes' => [
'tec-admin__upsell-link--underlined'
],
'text' => 'Event Tickets Plus',
'url' => 'https://evnt.is/1bd9',
],
] );
echo '</div>';
}

/**
Expand Down Expand Up @@ -214,15 +237,39 @@ public function render_ticket_type_upsell_notice( string $file, array $name, Tem
/**
* Show upsell on Emails Settings page.
*
* @deprecated TBD
*
* @since 5.7.1
*
* @param array $fields Template list settings fields.
*
* @return array Filtered template list settings fields.
*/
public function show_on_emails_settings_page( $fields ) {
_deprecated_function( __METHOD__, 'TBD', '' );
// If they already have ET+ activated or are not within the admin area, then bail.
if ( class_exists( '\TEC\Tickets_Wallet_Plus\Plugin', false ) || ! is_admin() ) {
return $fields;
}

$fields[] = [
'type' => 'html',
'html' => tribe( Upsell_Notice\Main::class )->render( [
'classes' => [
'tec-admin__upsell-tec-tickets-wallet-plus'
],
'text' => sprintf(
// Translators: %s: Link to "Wallet Plus" plugin.
esc_html__( 'Get additional ticketing flexibility including Apple Wallet and PDF tickets with %s' , 'event-tickets' ),
''
),
'link' => [
'classes' => [
'tec-admin__upsell-link--underlined'
],
'text' => 'Wallet Plus',
'url' => 'https://evnt.is/1bd8',
],
], false ),
];

return $fields;
}
}

0 comments on commit 5f625fb

Please sign in to comment.