benecaster_get_user_id_by_subscriber_email()
benecaster_get_user_id_by_subscriber_email( string $email ): int
Resolves an email address to a WordPress user ID, or 0. The cheap first step for an integration working from email addresses — it lets a caller bail early without the null check that get_user_by() forces.
There is deliberately no show argument. A WordPress user is site-wide; scoping to a show is what the tier and access functions are for.
Reach for benecaster_get_subscriber_data() instead when you want the tier, token state and display name as well. It is one lookup rather than this one plus the follow-ups, and it distinguishes “no such user” from “user with no token for this show” — a distinction a bare ID cannot express.
Parameters
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
email |
string |
— | Yes | Email address to look up. Trimmed before matching. |
Return Value
Type:
int
WordPress user ID, or 0 when no user holds that email.
Example
$user_id = benecaster_get_user_id_by_subscriber_email( $row['email'] );
if ( ! $user_id ) {
continue;
}
$tier = benecaster_get_user_tier_for_show( $show_id, $user_id );
Notes
Zero means "no WordPress user has this email", and nothing more. It does not mean the person is not a subscriber under a different address, and it is not a statement about tokens, tiers, or payment.
The email is trimmed before matching, the same as in benecaster_get_subscriber_data(). The two agree about which addresses resolve on purpose — a caller that branches on this one and then calls that one would otherwise be able to get contradictory answers.
Need this built rather than just documented? See our services →