Home Forums Newsletter Plugin Support Username ( user_login ) empty on registration/subscription

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #348656
    Francesca
    Participant

    Hello!
    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

    #348668
    Michael
    Keymaster

    Hello 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

    #348679
    Francesca
    Participant

    Many thanks Michael!
    I’ll look into it too, and let you know about it. 🙂

    #348695
    Francesca
    Participant

    Update:
    I checked the “username” form field:

    * on the WP core login/registration -> user_login
    * on the User Registration plugin -> user_login

    However, 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,
    Francesca

    #348705
    Michael
    Keymaster

    Hello Francesca,

    I’ve let our developers know about this, I’ll be back as soon as possible with their findings.

    Thanks,
    Michael

    #348747
    Francesca
    Participant

    Hello Michael, great news + bugfix!
    I inspected the WP Users addon code and found the culprint:

    index.php in line 34
    plugin.php in line 351

    THE 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

    #348935
    Michael
    Keymaster

    Hello 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

    #348953
    Francesca
    Participant

    Hello 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

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.