Skip to content
Docs
Get RestroPress

Filter

rpress_should_update_payment_status

Updated
On this page

Filters whether RPRESS_Payment::update_status should change the payment status.

Applied after the new status was normalised (completed becomes publish) and found to differ from the old status. Return false to cancel the change; no status actions will fire.

Parameters#

ParameterTypeDescription
$do_changeboolTrue to proceed with the change.
$payment_idintID of the payment.
$statusstringThe new status.
$old_statusstring|falseThe previous status, or false if none is recorded.

Return value#

bool. Whether the status change is allowed.

Example#

function my_block_refund( $do_change, $payment_id, $status, $old_status ) {
	if ( 'refunded' === $status && ! current_user_can( 'manage_options' ) ) {
		return false;
	}
	return $do_change;
}
add_filter( 'rpress_should_update_payment_status', 'my_block_refund', 10, 4 );

Source#

Applied in:

  • includes/payments/class-rpress-payment.php (line 1459), in RPRESS_Payment::update_status()

See also#

Was this page helpful?