Filter
rpress_payment_user_id
On this page
Filters the WordPress user ID returned for a payment.
Runs when the WordPress user ID linked to the order (0 for guests) property is read from an RPRESS_Payment object (for example $payment->user_id), through the object's magic getter. Reads made inside the class itself go straight to the property and are not filtered.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$user_id | int | The value loaded for the payment. |
$payment_id | int | The payment (order) ID. |
$payment | RPRESS_Payment | The payment object being read. |
Return value#
int. The (possibly modified) value returned for the property.
Example#
add_filter( 'rpress_payment_user_id', 'my_match_payment_user_by_email', 10, 3 );
function my_match_payment_user_by_email( $user_id, $payment_id, $payment ) {
if ( empty( $user_id ) ) {
$user = get_user_by( 'email', $payment->email );
if ( $user ) {
return (int) $user->ID;
}
}
return $user_id;
}
Source#
Applied in:
includes/payments/class-rpress-payment.php(line 2256), inRPRESS_Payment::get_user_id()
See also#
Was this page helpful?
