feat(integrations): add PeepSo registration form integration#822
Open
faisalahammad wants to merge 1 commit intoibericode:mainfrom
Open
feat(integrations): add PeepSo registration form integration#822faisalahammad wants to merge 1 commit intoibericode:mainfrom
faisalahammad wants to merge 1 commit intoibericode:mainfrom
Conversation
- Add MC4WP_PeepSo_Integration class extending MC4WP_User_Integration - Hook into peepso_register_extended_fields for checkbox output - Hook into peepso_register_new_user for subscription processing - Register integration in autoload classmap and bootstrap Fixes ibericode#696
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Summary
Adds a new PeepSo registration form integration that allows users to subscribe to Mailchimp lists when registering through PeepSo's
[peepso_register]shortcode form.📋 Issue Reference
Fixes #696
🔍 Problem Description
Current Behavior
Mailchimp for WordPress does not integrate with PeepSo's registration form. Users who register through PeepSo cannot opt-in to Mailchimp email lists during the registration process.
Expected Behavior
A "Subscribe to our newsletter" checkbox should appear in the PeepSo registration form, and checking it should subscribe the user to the configured Mailchimp list upon successful registration.
Root Cause
No integration class exists for PeepSo. The plugin needs a dedicated integration that hooks into PeepSo's registration hooks to output the checkbox and process the subscription.
✨ Solution Overview
Approach Taken
Created a new
MC4WP_PeepSo_Integrationclass extendingMC4WP_User_Integration(the same base class used by the BuddyPress integration). This follows the established pattern used by all other user-based integrations in the plugin.The integration hooks into two PeepSo actions:
peepso_register_extended_fieldspeepso_register_new_userWhy This Approach
MC4WP_BuddyPress_Integration), which also extendsMC4WP_User_IntegrationMC4WP_User_IntegrationandMC4WP_Integrationtriggered()→user_merge_vars()→subscribe()flow proven by other integrationsAlternatives Considered
peepso_register_verifiedinstead ofpeepso_register_new_user: Would delay subscription until email verification (if enabled). Not chosen because other integrations subscribe at user creation time, and the Mailchimp API handles double opt-in separately.peepso_register_form_fieldsfilter: Would inject the checkbox as a PeepSo form field. Not chosen because it would couple the implementation to PeepSo's form rendering internals, whereaspeepso_register_extended_fieldsis the designated hook for third-party additions.🔧 Changes Made
Files Modified
integrations/peepso/class-peepso.php- [NEW] PeepSo integration classautoload.php- Added classmap entry for the new classintegrations/bootstrap.php- Registered the integrationDetailed Changes
1. New File:
integrations/peepso/class-peepso.phpWhy This Works:
peepso_register_extended_fieldsfires inside the registration form, after the standard fields, which is the designated hook point for third-party field additionspeepso_register_new_userfires after successful user creation and passes the$user_idtriggered()checks whether the checkbox was checked (or implicit mode is enabled)user_merge_vars()extracts the user's email, first name, and last name fromWP_Usersubscribe()handles the Mailchimp API call with all configured optionsImpact:
2.
autoload.php'MC4WP_Ninja_Forms_V2_Integration' => '/integrations/ninja-forms-2/class-ninja-forms.php', + 'MC4WP_PeepSo_Integration' => '/integrations/peepso/class-peepso.php', 'MC4WP_Plugin' => '/includes/class-plugin.php',3.
integrations/bootstrap.phpmc4wp_register_integration('memberpress', 'MC4WP_MemberPress_Integration'); + mc4wp_register_integration('peepso', 'MC4WP_PeepSo_Integration'); mc4wp_register_integration('affiliatewp', 'MC4WP_AffiliateWP_Integration');🧪 Testing Performed
Automated Testing
✅ All 54 existing tests pass with 175 assertions — zero regressions.
Manual Testing
Test Case 1: Integration Appears in Admin
Steps:
Expected Result: "PeepSo" appears in the integrations list
Actual Result: ✅ PeepSo integration is listed and configurable
Test Case 2: Integration Shows "Not Installed" Without PeepSo
Steps:
Expected Result: PeepSo integration shows as not installed
Actual Result: ✅
is_installed()correctly returnsfalsewhen PeepSo class doesn't exist🔒 Security Considerations
MC4WP_User_Integrationmethodsget_userdata()functiontriggered()which usessanitize_text_fieldinternallyoutput_checkbox()♿ Accessibility
MC4WP_Integration::output_checkbox()method🌍 Internationalization
✅ No breaking changes — This is a purely additive feature. Existing integrations and functionality are completely unaffected.
Screenshots
✅ PR Checklist
🤝 Additional Context
MC4WP_BuddyPress_Integrationalmost exactly, ensuring consistency across the codebaseclasses/register.phplines 2906-2910)peepso_register_extended_fieldshook is the officially recommended extension point for third-party registration fields in PeepSo