Lesson 105 — Automatic Winner Notification System
Now that Lesson 104 introduced the automated auction lifecycle (scheduled activation and automatic closing), the next logical milestone is notifying everyone involved when an auction finishes.
This adds real business value because an auction platform should communicate results automatically rather than requiring administrators to monitor auctions manually.
Objective
Create an automatic notification system that sends notifications immediately after an auction closes and a winner has been determined.
Initially, notifications will be written to the Activity Log.
Later lessons will expand this to:
- Email notifications
- Dashboard notifications
- Buyer dashboard alerts
- Seller dashboard alerts
- Webhooks
- SMS/WhatsApp (optional)
What will happen automatically?
Current workflow
Auction Ends
↓
Cron Job
↓
Auction Closed
↓
Winner Determined
New workflow
Auction Ends
↓
Cron Job
↓
Auction Closed
↓
Winner Determined
↓
Winner Notification
↓
Seller Notification
↓
Administrator Notification
Notifications to create
1. Winner
Example
Congratulations!
You won the auction for
example.com
Winning Bid:
$1,250
Please complete payment within 7 days.
2. Seller
Example
Your auction has ended.
Winner:
John
Winning Bid:
$1,250
Waiting for payment.
3. Administrator
Example
Auction Closed
Listing:
example.com
Winner:
John
Winning Bid:
$1,250
Transaction Created:
Yes
New Class
includes/
class-notification-manager.php
Responsibilities
- notify_winner()
- notify_seller()
- notify_admin()
- future email support
- future dashboard support
Initial Implementation
For now we won’t send emails.
Instead we’ll use
Flipnzee_Activity_Log::log()
This lets us verify the notification workflow before integrating email providers.
Example
Winner Notification Sent
Seller Notification Sent
Admin Notification Sent
Hook Integration
Lesson 104 already introduced an excellent hook:
flipnzee_auctions_expired_processed
Lesson 105 introduces another event-driven hook:
flipnzee_auction_winner_determined
When this action fires:
Winner Determined
↓
Notification Manager
↓
Notify Winner
Notify Seller
Notify Admin
No existing code needs modification.
This follows proper WordPress architecture.
Future Expansion
The same Notification Manager will later support
- HTML Email Templates
- WooCommerce Mailer
- WP Mail SMTP
- Slack
- Discord
- Telegram
- SMS
- Push Notifications
without changing the auction logic.
Files to Modify
New
includes/class-notification-manager.php
Modify
includes/class-loader.php
Load the new class.
Modify
flipnzee-auctions.php
Initialize the notification hooks.
Why This Lesson Matters
By the end of Lesson 105, Flipnzee Auctions will evolve from simply closing auctions automatically to communicating auction outcomes automatically. This is a key feature expected in any production auction platform and lays the foundation for robust email, dashboard, and third-party notification systems in future lessons.
Expected Outcome
After Lesson 105:
- ✔ Winner determined automatically
- ✔ Transaction created automatically
- ✔ Transfer record created automatically
- ✔ Notification events generated automatically
- ✔ Activity Log records every notification
- ✔ Ready for email notifications in subsequent lessons
This lesson continues the transition from a functional auction engine to a complete marketplace workflow.
