- Handle Custom Stripe Webhook Events
- suredonation_export_secret_option_keys Filter Hook
- suredonation_import_batch_complete Action Hook
- suredonation_import_complete Action Hook
- suredonation_import_donation_inserted Action Hook
- suredonation_import_donor_inserted Action Hook
- suredonation_import_session_created Action Hook
- suredonation_import_givewp_batch_complete Action Hook
- suredonation_import_givewp_session_created Action Hook
- suredonation_privacy_data_exported Action Hook
- Validate Field Filter Hook
- Validatable Blocks Filter Hook
- Update donation data, Filter Hook
- OttoKit Integration: suredonation_suretriggers_integration_data_filter Filter Hook
- suredonation_show_setup_gateway_notice Filter Hook
- suredonation_show_review_notice_gateway Filter Hook
- suredonation_show_review_notice_donation Filter Hook
- suredonation_registered_payment_methods Filter Hook
- suredonation_register_additional_blocks Filter Hook
- suredonation_receipt_html Filter Hook
- suredonation_phone_geo_enabled Filter Hook
- suredonation_phone_geo_api_hourly_cap Filter Hook
- suredonation_paypal_webhook_handle_event Filter Hook
- suredonation_paypal_sdk_args Filter Hook
- suredonation_output_campaign_meta_tags Filter Hook
- suredonation_new_donor_user_data Filter Hook
- suredonation_integration_payload Filter Hook
- suredonation_import_phase_mappers Filter Hook
- suredonation_import_givewp_phases Filter Hook
- suredonation_import_givewp_phase_mappers Filter Hook
- suredonation_import_donation_row Filter Hook
- suredonation_import_campaigns_limit Filter Hook
- suredonation_field_block_config Filter Hook
- suredonation_export_one_time_only Filter Hook
- suredonation_export_campaigns_limit Filter Hook
- suredonation_email_smart_tags Filter Hook
- suredonation_email_smart_tag_groups Filter Hook
- suredonation_email_field_char_limits Filter Hook
- suredonation_disable_default_styles Filter Hook
- suredonation_default_validation_messages Filter Hook
- suredonation_default_email_notifications Filter Hook
- suredonation_create_donation_data Filter Hook
- suredonation_config_abilities Filter Hook
- suredonation_available_payment_methods Filter Hook
- suredonation_allowed_form_html Filter Hook
- suredonation_allowed_form_blocks Filter Hook
- Validatable Blocks Filter Hook
- Update donation data, Filter Hook
- OttoKit Integration: suredonation_suretriggers_integration_data_filter Filter Hook
- suredonation_show_setup_gateway_notice Filter Hook
- suredonation_show_review_notice_gateway Filter Hook
- suredonation_show_review_notice_donation Filter Hook
- suredonation_registered_payment_methods Filter Hook
- suredonation_register_additional_blocks Filter Hook
- suredonation_receipt_html Filter Hook
- suredonation_phone_geo_enabled Filter Hook
- suredonation_phone_geo_api_hourly_cap Filter Hook
- suredonation_paypal_webhook_handle_event Filter Hook
- suredonation_paypal_sdk_args Filter Hook
- suredonation_output_campaign_meta_tags Filter Hook
- suredonation_new_donor_user_data Filter Hook
- suredonation_integration_payload Filter Hook
- suredonation_import_phase_mappers Filter Hook
- suredonation_import_givewp_phases Filter Hook
- suredonation_import_givewp_phase_mappers Filter Hook
- suredonation_import_donation_row Filter Hook
- suredonation_import_campaigns_limit Filter Hook
- suredonation_field_block_config Filter Hook
- suredonation_export_secret_option_keys Filter Hook
- suredonation_export_one_time_only Filter Hook
- suredonation_export_campaigns_limit Filter Hook
- suredonation_email_smart_tags Filter Hook
- suredonation_email_smart_tag_groups Filter Hook
- suredonation_email_field_char_limits Filter Hook
- suredonation_disable_default_styles Filter Hook
- suredonation_default_validation_messages Filter Hook
- suredonation_default_email_notifications Filter Hook
- suredonation_create_donation_data Filter Hook
- suredonation_config_abilities Filter Hook
- suredonation_available_payment_methods Filter Hook
- suredonation_allowed_form_html Filter Hook
- suredonation_allowed_form_blocks Filter Hook
- suredonation_import_batch_complete Action Hook
- suredonation_import_complete Action Hook
- suredonation_import_donation_inserted Action Hook
- suredonation_import_donor_inserted Action Hook
- suredonation_import_session_created Action Hook
- suredonation_import_givewp_batch_complete Action Hook
- suredonation_import_givewp_session_created Action Hook
- suredonation_privacy_data_exported Action Hook
- suredonation_enqueue_form_frontend_scripts Action Hook
- suredonation_after_form_duplicated Action Hook
- suredonation_email_sent Action Hook
- suredonation_donor_user_created Action Hook
- suredonation_donation_refunded Action Hook
- suredonation_donation_status_changed Action Hook
- suredonation_donation_completed Action Hook
- suredonation_new_donation Action Hook
- suredonation_donation_created Action Hook
suredonation_new_donor_user_data Filter Hook
Overview
The suredonation_new_donor_user_data filter allows developers to modify the WordPress user data before SureDonation creates a new WordPress account for a donor.
You can use this filter to customize the data passed to wp_insert_user(), such as changing the user’s role, display name, or other supported user fields.
You can also use the filter to prevent the WordPress account from being created.
When to Use This Filter
Use this filter when you need to:
- Change the default donor WordPress role.
- Customize the donor’s display name.
- Modify user information before account creation.
- Add supported WordPress user fields.
- Apply custom logic to donor account creation.
- Prevent a WordPress account from being created.
Filter Signature
apply_filters(  'suredonation_new_donor_user_data', $user_data,  $donor_id,  $email);Parameters
| Parameter | Type | Description |
| $user_data | array | User data that will be passed to wp_insert_user(). |
| $donor_id | int | The SureDonation donor record ID. |
| string | Email address associated with the donor. |
$user_data
The array always contains:
| Key | Description |
| user_login | WordPress username. |
| user_email | Donor email address. |
| user_pass | Generated WordPress user password. |
| role | Default donor role: suredonation_donor. |
When the donor’s name is available, the array also includes:
- first_name
- last_name
- display_name
Return Value
Return the modified $user_data array to continue with WordPress user creation.
return $user_data;
To prevent the account from being created, return false or any non-array value.
return false;
When account creation is aborted:
- No WordPress user is created.
- suredonation_donor_user_created does not fire.
Basic Usage
add_filter( 'suredonation_new_donor_user_data', 'your_custom_function', 10, 3 );
function your_custom_function( $user_data, $donor_id, $email ) {
    // Modify or inspect $user_data here.
    return $user_data;
}Example: Change the Donor Role
The following example assigns a custom supporter role instead of the default suredonation_donor role.
add_filter( 'suredonation_new_donor_user_data', 'mysite_donor_role', 10, 3);
function mysite_donor_role( $user_data, $donor_id, $email ) {
    // Give donors a custom role instead of the default.
    $user_data['role'] = 'supporter';
    return $user_data;
}Example: Customize the Display Name
You can modify the display name before the WordPress account is created.
add_filter( 'suredonation_new_donor_user_data', 'mysite_donor_display_name', 10,  3);
function mysite_donor_display_name( $user_data, $donor_id, $email ) {
    if ( ! empty( $user_data['first_name'] ) ) {
        $user_data['display_name'] = $user_data['first_name'];
    }
    return $user_data;
}Example: Prevent Account Creation
Return a non-array value to stop SureDonation from creating the WordPress account.
add_filter( 'suredonation_new_donor_user_data', 'mysite_prevent_donor_account', 10, 3);
function mysite_prevent_donor_account( $user_data, $donor_id, $email ) {
    if ( '[email protected]' === $email ) {
        return false;
    }
    return $user_data;
}In this example, the WordPress account is not created for the specified email address.
User Creation Flow
The filter is part of the donor-to-WordPress-user linking process:
- A donor record is processed by SureDonation.
- SureDonation checks whether WordPress user creation is enabled.
- If a new user needs to be created, the default $user_data array is prepared.
- The suredonation_new_donor_user_data filter is applied.
- Your callback can modify the user data or abort the process.
- If an array is returned, SureDonation passes the data to wp_insert_user().
- If a non-array value is returned, account creation is stopped.
- When a user is successfully created, the suredonation_donor_user_created action can fire.
Related Hooks
- suredonation_donor_user_created : Runs after a WordPress user has been successfully created for a donor.
We don't respond to the article feedback, we use it to improve our support content.