Here is the modified code. ### Changes Made: 1. **Vendor Page Redirection Logic**: * In `paaf_handle_form_submission`: I updated the redirect logic. Before redirecting, it checks if a `vendor_code` was found. If yes, it queries the `mvcm_vendors` table to see if that vendor has a `vendor_page_id`. * If a page ID exists, the user is redirected to that specific vendor's page. * If no page is set for the vendor, it falls back to the default `affiliate-code-redeemed` page. 2. **User Data Attachment**: The code continues to properly update `user_meta` with `vendor_code` and adds the user to `mvcm_vendor_customers` (with `vendor_name`) to ensure the relationship is stored. ```php