Home › Forums › Newsletter Plugin Support › Username ( user_login ) empty on registration/subscription
- This topic has 7 replies, 2 voices, and was last updated 1 week, 2 days ago by
Francesca.
-
AuthorPosts
-
September 27, 2025 at 3:30 pm #348656
Francesca
ParticipantHello!
I’m new to this awesome plugin, still setting things up.I tested a new user registration with “User Registration & Membership” plugin and the “WP Users Addon”.
The registration plugin uses “user_email” and “user_login” as field IDs. I can’t change them.However only the user’s email is passed to the Newsletter plugin, no username.
* How can I pass the name/username field to the Newsletter plugin?
Thank you for any hint! 🙂
Francesca
September 28, 2025 at 10:03 am #348668Michael
KeymasterHello Francesca,
we are not currently integrated with that plugin, so we cannot predict which fields and id’s are used. Our addon works only if the standard WordPress registration process is used. I’ll take a look anyways, and get back to you.
Michael
September 28, 2025 at 12:23 pm #348679Francesca
ParticipantMany thanks Michael!
I’ll look into it too, and let you know about it. 🙂September 29, 2025 at 10:57 am #348695Francesca
ParticipantUpdate:
I checked the “username” form field:* on the WP core login/registration -> user_login
* on the User Registration plugin -> user_loginHowever, the Newsletter plugin doesn’t recognize it, and shows a blank cell under the “name” column on the “All subcribers” page.
I also tried with “nickname” and “first_name” with no luck.Michael, could you please tell me the default fieldname for the username in the Newsletter plugin?
So I can test further. 🙂Many thanks,
FrancescaSeptember 29, 2025 at 1:37 pm #348705Michael
KeymasterHello Francesca,
I’ve let our developers know about this, I’ll be back as soon as possible with their findings.
Thanks,
MichaelSeptember 30, 2025 at 11:12 am #348747Francesca
ParticipantHello Michael, great news + bugfix!
I inspected the WP Users addon code and found the culprint:index.php in line 34
plugin.php in line 351THE PROBLEM:
The code assumes that the frontend form provides “first name” and “last name” fields, and that the user filled them in. Therefore, on basic forms with only username (user_login) and email, the code returns no WordPress “name” data for the plugin.THE SOLUTION:
I added 2 fallbacks as follows:on index.php
if($wp_user->first_name == ”) { $newsletter->sanitize_name(strval($wp_user->user_login)); }on plugin.php
if (get_user_meta($wp_user_id, ‘first_name’, true) == ”) { $subscription->data->name = $wp_user->user_login; }Yes, they’re rough, but they do the job. 🙂
I hope this is helpful, and I prey that your developers implement such fallbacks in the next update.
Thankyou!Francesca
October 2, 2025 at 10:24 am #348935Michael
KeymasterHello Francesca,
I think that would work but unfortunately we can’t put that into the plugin in a production version, because if someone puts sensitive informations in the login field it wouldn’t be safe to have them sent through regular emails.
You could also try filtering subscriptions with the newsletter_subscription hook and then manage data as you prefer.
Hope that makes sense,
Michael
October 2, 2025 at 11:21 am #348953Francesca
ParticipantHello Michael,
I can unserstand your point about sensitive data, although I don’t think It’ll go beyond “FrancescaUrbinati80” or something like that. Also, It won’t be the default, only a fallback in case the the form is minimal (aka username and email).Please, could you give me more details about the newsletter_subscription hook?
Is there a chapter in the docs? (I couldn’t find it, sorry)Thank you!
Francesca
-
AuthorPosts
- You must be logged in to reply to this topic.