Forum Replies Created
-
AuthorPosts
-
October 2, 2025 at 11:21 am in reply to: Username ( user_login ) empty on registration/subscription #348953
Francesca
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
September 30, 2025 at 11:12 am in reply to: Username ( user_login ) empty on registration/subscription #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
September 29, 2025 at 10:57 am in reply to: Username ( user_login ) empty on registration/subscription #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 28, 2025 at 12:23 pm in reply to: Username ( user_login ) empty on registration/subscription #348679Francesca
ParticipantMany thanks Michael!
I’ll look into it too, and let you know about it. 🙂 -
AuthorPosts