wp_sms_mi_pm_optin_notification
Control SMS opt-in status for Paid Memberships Pro users.
This filter allows you to control the SMS notification opt-in status for users in the Paid Memberships Pro integration.
Usage
add_filter('wp_sms_mi_pm_optin_notification', function ($optIn, $userId) {
// Your logic here
return $optIn;
}, 10, 2);
Parameters
| Parameter | Type | Description |
|---|---|---|
$optIn | bool | Current opt-in status |
$userId | int | The user ID |
Example: Check User Meta for Opt-In
Only send SMS notifications to users who have explicitly opted in:
add_filter('wp_sms_mi_pm_optin_notification', function ($optIn, $userId) {
$optInStatus = get_user_meta($userId, 'sms_opt_in_status', true);
if (empty($optInStatus)) {
return false;
}
return $optIn;
}, 10, 2);
How It Works
- The filter checks the user’s opt-in preference from their metadata
- If the metadata is empty, the function returns
false - This prevents SMS notifications from being sent to users who haven’t consented
Related
- Notifications Settings - Configure SMS notifications
- Newsletter Settings - Manage subscriber opt-in
Last updated: December 26, 2024