Memberpress set email dynamically in registration form

169 views Asked by At

Hi I would like to know if there is a way to set the email in the membership registration page dynamically from url parameters that are passed.

Currently I am passing this in my URL:

domain/login-details/?email=char%40gmail.com&sub=Monthly

I would like to set the membership email equal to the parameter passed but I cannot seem to find a way. I only found how to add more fields.

1

There are 1 answers

0
Ben Borchard On

I'm not sure there is a way to do this through Memberpress configuration, but you could add some custom javascript that could achieve this:

emailInput = document.querySelector('input[name="user_email"]')
if (emailInput) {
  urlParams = new URLSearchParams(window.location.search)
  emailInput.value = urlParams.get('email');
}