From a48c7dbb62ef64f875edbe4d1c2b0bbef52b7ce0 Mon Sep 17 00:00:00 2001 From: Claire Atwell Date: Tue, 26 Mar 2024 15:50:04 -0400 Subject: [PATCH] [#832] Tweaks to email copy and URL fixes (#833) * [#832] add bids to auction summary intro * [#832] update auction summary admin conclusion * [#832] auction summary admin plain text updates * [#832] remove extra period * [#832] remove extra period * [#832] add bid to subject line * [#832] Add free bid to subject line * [#832] add free bid url * [#832] update auction free bid earned * Update auction-free-bid-earned.php * [n/a] removing duplicate free-bid email - Updating free_bids_url --------- Co-authored-by: Nathan Schmidt <91974372+nathan-schmidt-viget@users.noreply.github.com> --- .../Emails/AuctionFreeBidEarned.php | 102 ------------------ .../WooCommerce/Emails/AuctionFreeBidUsed.php | 2 +- .../Emails/AuctionPaidBidPlaced.php | 2 +- .../Plugins/WooCommerce/Emails/Email.php | 14 ++- .../WooCommerce/Emails/FreeBidEarned.php | 3 +- .../goodbids/src/classes/Users/FreeBids.php | 12 +++ .../emails/auction-free-bid-earned.php | 48 --------- .../emails/auction-free-bid-used.php | 2 +- .../emails/auction-summary-admin.php | 4 +- .../woocommerce/emails/free-bid-earned.php | 2 +- .../emails/plain/auction-free-bid-earned.php | 37 ------- .../emails/plain/auction-summary-admin.php | 4 +- 12 files changed, 32 insertions(+), 200 deletions(-) delete mode 100644 client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails/AuctionFreeBidEarned.php delete mode 100644 client-mu-plugins/goodbids/views/woocommerce/emails/auction-free-bid-earned.php delete mode 100644 client-mu-plugins/goodbids/views/woocommerce/emails/plain/auction-free-bid-earned.php diff --git a/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails/AuctionFreeBidEarned.php b/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails/AuctionFreeBidEarned.php deleted file mode 100644 index 73b6657e1..000000000 --- a/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails/AuctionFreeBidEarned.php +++ /dev/null @@ -1,102 +0,0 @@ -title = __( 'Auction Free Bid Earned', 'goodbids' ); - $this->description = __( 'Notification email sent to participant when free bid is earned.', 'goodbids' ); - $this->template_html = 'emails/auction-free-bid-earned.php'; - $this->template_plain = 'emails/auction-free-bid-earned.php'; - $this->bidder_email = true; - - $this->trigger_on_free_bid_earned(); - } - - /** - * Trigger this email on free bid earned. - * - * @since 1.0.0 - * - * @return void - */ - private function trigger_on_free_bid_earned(): void { - // TODO fire Trigger - } - - /** - * Get email subject. - * - * @since 1.0.0 - * @return string - */ - public function get_default_subject(): string { - return sprintf( - /* translators: %1$s: site title */ - __( '[%1$s] Congratulations, you earned a Free Bid!', 'goodbids' ), - '{site_title}', - ); - } - - /** - * Get email heading. - * - * @since 1.0.0 - * @return string - */ - public function get_default_heading(): string { - return __( 'Ready to GOODBID for free?', 'goodbids' ); - } - - /** - * Get button text - * - * @since 1.0.0 - * @return string - */ - public function get_default_button_text(): string { - return __( 'View Free Bids', 'goodbids' ); - } - - /** - * Set Button URL - * - * @since 1.0.0 - * - * @return string - */ - public function get_button_url(): string { - // TODO update this the right link - return '{free_bids.url}'; - } -} diff --git a/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails/AuctionFreeBidUsed.php b/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails/AuctionFreeBidUsed.php index 47b883563..8e595f515 100644 --- a/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails/AuctionFreeBidUsed.php +++ b/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails/AuctionFreeBidUsed.php @@ -77,7 +77,7 @@ function ( int $order_id ) { public function get_default_subject(): string { return sprintf( /* translators: %1$s: site title, %2$s: auction title */ - __( '[%1$s] %2$s Confirmation', 'goodbids' ), + __( '[%1$s] %2$s Free Bid Confirmation', 'goodbids' ), '{site_title}', '{auction.title}' ); diff --git a/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails/AuctionPaidBidPlaced.php b/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails/AuctionPaidBidPlaced.php index 717413990..35adf6937 100644 --- a/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails/AuctionPaidBidPlaced.php +++ b/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails/AuctionPaidBidPlaced.php @@ -77,7 +77,7 @@ function ( int $order_id ) { public function get_default_subject(): string { return sprintf( /* translators: %1$s: site title, %2$s: auction title */ - __( '[%1$s] %2$s Confirmation', 'goodbids' ), + __( '[%1$s] %2$s Bid Confirmation', 'goodbids' ), '{site_title}', '{auction.title}' ); diff --git a/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails/Email.php b/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails/Email.php index 5f1714028..d1f598297 100644 --- a/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails/Email.php +++ b/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails/Email.php @@ -150,7 +150,7 @@ private function has_initialized(): bool { */ private function add_button_support(): void { /* translators: %s: list of placeholders */ - $placeholder_text = sprintf( __( 'Available placeholders: %s', 'goodbids' ), '' . esc_html( implode( ', ', array_keys( $this->placeholders ) ) ) . '' ); + $placeholder_text = sprintf( __( 'Available placeholders: %s', 'goodbids' ), '' . esc_html( implode( ', ', array_keys( $this->placeholders ) ) ) . '' ); // Custom Fields $this->set_form_field( @@ -239,6 +239,7 @@ public function get_default_button_text(): string { public function get_button_text(): string { /** * Filter the button text. + * * @since 1.0.0 * * @param string $button_text The button text. @@ -481,6 +482,7 @@ private function default_placeholders(): void { $this->add_placeholder( '{user.name}', $this->get_user_name() ); $this->add_placeholder( '{user.account_url}', wc_get_page_permalink( 'myaccount' ) ); $this->add_placeholder( '{user.free_bid_count}', goodbids()->free_bids->get_available_count( $this->user_id ) ); + $this->add_placeholder( '{user.free_bids_url}', goodbids()->free_bids->get_free_bids_url( $this->user_id ) ); $this->add_placeholder( '{user.referral_link}', $referrer->get_link() ); // Order Details @@ -684,7 +686,7 @@ protected function get_email_vars(): array { * @since 1.0.0 * * @param string $key - * @param mixed $value + * @param mixed $value * * @return void */ @@ -734,6 +736,7 @@ public function get_content_plain(): string { /** * Add or change a form field. + * * @since 1.0.0 * * @param string $key @@ -893,7 +896,12 @@ public function send_to_bidders( Auction $auction ): void { * @return void */ public function send_to_admins( mixed $object ): void { - $admins = get_users( [ 'role' => 'administrator', 'fields' => 'ID' ] ); + $admins = get_users( + [ + 'role' => 'administrator', + 'fields' => 'ID', + ] + ); if ( $this->is_super_admins_email() ) { $super_admins = get_super_admins(); diff --git a/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails/FreeBidEarned.php b/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails/FreeBidEarned.php index daffb3b61..3c0dd7fb3 100644 --- a/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails/FreeBidEarned.php +++ b/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails/FreeBidEarned.php @@ -8,7 +8,6 @@ namespace GoodBids\Plugins\WooCommerce\Emails; -use GoodBids\Plugins\WooCommerce\Account; use GoodBids\Users\FreeBid; defined( 'ABSPATH' ) || exit; @@ -102,6 +101,6 @@ public function get_default_button_text(): string { * @return string */ public function get_button_url(): string { - return wc_get_endpoint_url( Account::FREE_BIDS_SLUG ); + return '{user.free_bids_url}'; } } diff --git a/client-mu-plugins/goodbids/src/classes/Users/FreeBids.php b/client-mu-plugins/goodbids/src/classes/Users/FreeBids.php index 389ff9de3..b42b82b59 100644 --- a/client-mu-plugins/goodbids/src/classes/Users/FreeBids.php +++ b/client-mu-plugins/goodbids/src/classes/Users/FreeBids.php @@ -9,6 +9,7 @@ namespace GoodBids\Users; use GoodBids\Plugins\WooCommerce\Coupons; +use GoodBids\Plugins\WooCommerce\Account; use GoodBids\Utilities\Log; use WP_User; @@ -280,6 +281,17 @@ public function get_available_count( ?int $user_id = null ): int { return $this->get_count( $user_id, self::STATUS_UNUSED ); } + /** + * Get the URL for My Account -> Free Bids + * + * @since 1.0.1 + * + * @return string + */ + public function get_free_bids_url(): string { + return wc_get_page_permalink( 'myaccount' ) . Account::FREE_BIDS_SLUG; + } + /** * Award a Free Bid to a User * diff --git a/client-mu-plugins/goodbids/views/woocommerce/emails/auction-free-bid-earned.php b/client-mu-plugins/goodbids/views/woocommerce/emails/auction-free-bid-earned.php deleted file mode 100644 index 025c14786..000000000 --- a/client-mu-plugins/goodbids/views/woocommerce/emails/auction-free-bid-earned.php +++ /dev/null @@ -1,48 +0,0 @@ - -

- -

- -

- referring to friend', - ); - ?> -

- -%s.', diff --git a/client-mu-plugins/goodbids/views/woocommerce/emails/auction-summary-admin.php b/client-mu-plugins/goodbids/views/woocommerce/emails/auction-summary-admin.php index 5112869f6..fbeef70d6 100644 --- a/client-mu-plugins/goodbids/views/woocommerce/emails/auction-summary-admin.php +++ b/client-mu-plugins/goodbids/views/woocommerce/emails/auction-summary-admin.php @@ -27,7 +27,7 @@

- +

diff --git a/client-mu-plugins/goodbids/views/woocommerce/emails/free-bid-earned.php b/client-mu-plugins/goodbids/views/woocommerce/emails/free-bid-earned.php index 0b0b55243..7d46d40f7 100644 --- a/client-mu-plugins/goodbids/views/woocommerce/emails/free-bid-earned.php +++ b/client-mu-plugins/goodbids/views/woocommerce/emails/free-bid-earned.php @@ -39,7 +39,7 @@ %s.', diff --git a/client-mu-plugins/goodbids/views/woocommerce/emails/plain/auction-free-bid-earned.php b/client-mu-plugins/goodbids/views/woocommerce/emails/plain/auction-free-bid-earned.php deleted file mode 100644 index b5a49a03f..000000000 --- a/client-mu-plugins/goodbids/views/woocommerce/emails/plain/auction-free-bid-earned.php +++ /dev/null @@ -1,37 +0,0 @@ -plain_text_header(); - - -printf( - /* translators: %1$s: Last Bid Amount, %2$s: View all Auctions */ - esc_html__( 'This is confirmation that your recent %1$s has earned you a new Free Bid. Way to go! %2$s on GOODBIDS to find your next great cause to support.', 'goodbids' ), - '{user.free_bid_type}', - 'TODO View all Auctions', -); - -echo "\n\n----------------------------------------\n\n"; - -printf( - /* translators: %1$s: Free Bids */ - esc_html__( 'You have %1$s Free Bids that can be used in any eligible auction. You can earn more by placing one of the first five paid bids in any auction, or by', 'goodbids' ), - 'TODO {user.free_bid_count}', - 'TODO referring to friend', -); - -echo "\n\n----------------------------------------\n\n"; - -$instance->plain_text_footer(); diff --git a/client-mu-plugins/goodbids/views/woocommerce/emails/plain/auction-summary-admin.php b/client-mu-plugins/goodbids/views/woocommerce/emails/plain/auction-summary-admin.php index 4d172b51e..3d0ff8f17 100644 --- a/client-mu-plugins/goodbids/views/woocommerce/emails/plain/auction-summary-admin.php +++ b/client-mu-plugins/goodbids/views/woocommerce/emails/plain/auction-summary-admin.php @@ -24,7 +24,7 @@ printf( /* translators: %1$s: Auction title, %2$s: Auction end time, %3$s: Auction total Bids, %4$s: Auction total Raised, %5$s: Site name */ - esc_html__( 'The %1$s GOODBIDS auction ended on %2$s with %3$s placed and %4$s raised for %5$s. Check out the summary below for key auction metrics.', 'goodbids' ), + esc_html__( 'The %1$s GOODBIDS auction ended on %2$s with %3$s bids placed and %4$s raised for %5$s. Check out the summary below for key auction metrics.', 'goodbids' ), '{auction.title}', '{auction.end_date_time}', '{auction.bid_count}', @@ -115,7 +115,7 @@ echo "\n\n----------------------------------------\n\n"; -esc_html_e( 'The auction has ended. The auctioneer has chosen a winner. The winner will be notified by email and will be notified by text. The winner has 40 days to claim their reward. We will send you a confirmation email once the reward has been claimed.', 'goodbids' ); +esc_html_e( 'The auction has ended. The winner will be notified by email. The winner has 40 days to claim their reward.', 'goodbids' ); echo "\n\n----------------------------------------\n\n";