• Hey guys, I’m using newsletter plugin, and I’d like to start automatically adding all the newly registered users to the mailing list.
    I’ve written a function that I believe should work, but for some reason, it doesn’t. Could you have a look?

    add_action('user_register', 'add_to_newsletter');
    
    function add_to_newsletter($user_id){
    	$user = get_user_by('id', $user_id);
    	$email = $user->user_email;
    	global $wpdb;
    		$wpdb->insert($wpdb->prefix . ‘newsletter’, array(‘email’=>$email));
    }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘add value to database on register_user’ is closed to new replies.