• Hi Stefano, thank you for developing and sharing your work. Great plugin!

    I need a bit of help to achieve two events. Both are meant to process when a new WP user is registered in file subscription/subscription.php

    1. Pass userlogin to firstname in newsletter entry to subscribe() (I understand you specifically warned, as a comment, there will be no last or first name)

    2. I’m also trying to bypass double opt-in for new registered WP users, as they already receive an activation email for their WP account. It’s quite confusing for recipients to receive two different activation emails, one for WP, the other for newsletter. I understand that I should use simple opt-in to achieve that behaviour, but want to keep double just for new newsletter users.

    What I’ve tried so far:

    function newsletter_subscription_user_register($user_id) {
    [...]
    $_REQUEST['ne'] = $module->normalize_email($wp_user->user_email);
    $_REQUEST['nr'] = 'registration';
    // trying to provide userlogin as a name for subscription
    $_REQUEST['nn'] = $module->normalize_name($wp_user->user_login);
    // Upon registration there is no last name and first name, sorry.
    global $bypass;
    $bypass = true;
    [...]
    }

    and then

    function subscribe() {
    [...]
    if (!isset($opt_in)) {
    $opt_in = (int) $this->options['noconfirmation']; // 0 - double, 1 - single
    }
    // force opt_in 1 when called from user_register
    if ($bypass == true) {
    	$opt_in = 1;
    	}
    [...]
    // where user_login should be stored
    $user['name'] = $newsletter->normalize_name(stripslashes($_REQUEST['nn']));
    [...]
    // force status C when called
    if ($bypass == true) {
    $user['status'] = 'C';
    }
    }

    Thanks in advance for your time 🙂

    http://wordpress.org/extend/plugins/newsletter/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Bypass double opt-in for new wordpress users and passing user_login’ is closed to new replies.