Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subscriber button: prefill logged in email #42626

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Autofill logged in email'
Original file line number Diff line number Diff line change
Expand Up @@ -641,10 +641,11 @@ function render_block( $attributes ) {
return '';
}

// Prefill the email field with the current user's email if they are logged in via Memberships premium content token
$subscribe_email = Jetpack_Memberships::get_current_user_email();

/** This filter is documented in \Automattic\Jetpack\Forms\ContactForm\Contact_Form */
if ( is_wpcom() || false !== apply_filters( 'jetpack_auto_fill_logged_in_user', false ) ) {
// If no email, then prefill the email field with the current user's email if they are logged in
if ( empty( $subscribe_email ) ) {
$current_user = wp_get_current_user();
if ( ! empty( $current_user->user_email ) ) {
$subscribe_email = $current_user->user_email;
Expand Down
Loading