LLMS_Notification_Controller_Upcoming_Payment_Reminder::action_callback( int $order_id = null, string $type = null )
Callback function called when the upcoming payment reminder notification is fired
Parameters Parameters
- $order_id
-
(int) (Optional) WP Post ID of the order.
Default value: null
- $type
-
(string) (Optional) The notification type identifier.
Default value: null
Return Return
(boolean)
Source Source
File: includes/notifications/controllers/class.llms.notification.controller.upcoming.payment.reminder.php
public function action_callback( $order_id = null, $type = null ) {
// Make sure order_id and type have been provided.
if ( ! $order_id || ! $type ) {
return false;
}
// These checks are basically the same we do in LLMS_Controller_Orders::recurring_charge().
// Recurring payments disabled as a site feature when in staging mode.
if ( ! LLMS_Site::get_feature( 'recurring_payments' ) ) {
return false;
}
$order = llms_get_post( $order_id );
// Make sure the order still exists.
if ( ! $order || ! is_a( $order, 'LLMS_Order' ) ) {
return false;
}
$user_id = $order->get( 'user_id' );
// Check the user still exists.
if ( ! get_user_by( 'id', $user_id ) ) {
return false;
}
// Ensure Gateway is still available and supports recurring payments.
$gateway = $order->get_gateway();
if ( is_wp_error( $gateway ) || ! $gateway->supports( 'recurring_payments' ) ) {
return false;
}
$this->user_id = $user_id;
$this->post_id = $order->get( 'id' );
$this->send( false, array( $type ) );
return true;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 5.2.0 | Introduced. |