user_register
action hook is performed without any output, therefore you can’t echo anything from it.
If you’re looking to debug the output from this function, dump it to the error log.
function send_coupon_to_freshly_registered_user($user_id) {
$user = get_user_by('id',$user_id); //new line
$user_email = stripslashes($user->user_email); //changed line
error_log( print_r( $user_email, true ) ); // print_r the variable to error log.
}
add_action('user_register', 'send_coupon_to_freshly_registered_user', 10, 1);
Related Posts:
- How to fix ‘Notice: Undefined index:’ in PHP form action
- How to stop form resubmission on page refresh
- How to correctly submit a search form and display the result in an independent page
- add_filter the_content str_replace after shortcode
- Genesis – Customize search form
- How build a custom login/register form with error handling?
- Integrating WordPress to my website, while keeping my own authentication system
- Metabox repeating fields – radio buttons not saving correctly
- How to exclude pages from the search results
- How to insert PHP code in a WordPress Post
- Inserting Gravity Form checkbox values into Advanced Custom Fields [closed]
- How to handle a custom form in wordpress to submit to another page?
- Has anyone tried putting PHP ActiveRecord on WordPress?
- How to disable wordpress confirmation email for new users
- Handling error states with admin_post
- Creating wordpress user registration form
- wordpress separate registration for different roles
- Creating a WordPress form with a PHP script and default header
- On update to 3.04 site started recording accents as “á” and “á”, what to do?
- submit the form to same page
- Authenticating to WordPress, using my own authentication two-factor system
- Best way to create a user programatically
- How to add specific menu on a specific page or pages
- Why when I instantiate wp_error in a validation method my user registration method stops working?
- Submitting form via admin-post.php and handling errors
- Implement a multi-value input field where the number of entries is not limited
- Custom WordPress+PHP+MYSQL+AJAX form, submit event not captured by Javascript, but does POST data to the DB
- Passing POST data from one WP post to another
- Remove username in emails or swap username for email
- Getting the dropdown menu to redirect to different pages?
- Trigger Woocommerce New User Email
- Processing a subscription form with POST method?
- Passing the page ID to a login php script
- How to group 2 radio buttons in a widget?
- How to send user data in json format to another server when user register on wordpress site in PHP
- Ajax form submit within a Post Metabox
- items_wrap not working
- WordPress shows registration link for non logged users
- How to create and work with custom data / tables (i.e., for arbitrary data)?
- Upload Image in a WordPress page using PHP
- Using Multiple Submit buttons to trigger customised php functions
- Get Admin Email Address From External PHP page
- Form not working as it should in WordPress, but in a normal HTML site it does
- Submitting my form to the database and then redirecting to payment site
- Passing link parameter values to form
- Processing forms with php to wordpress database
- Ajax call URL 404’ing when pushed to staging server
- Update only some custom user fields
- Post from front end form to post_meta
- Passed variable gets undefined variable error on insert on next page
- Accessing values entered via form – try again
- Nonce fail after second submit attempt
- How to set up an auto delete post?
- Dynamic form variables for post meta
- Registration form not registering First and Last name
- Trying to display user meta by “name” – not by “ID”
- Styling admin page rows in order of importance (checkboxes)
- Headers for Contact Form are wrong
- Editing a WordPress plugin to add my own functionality
- how to register a second page-template
- Display default WordPress login/registration form into a modal window
- Using Nonce for my Form
- Trouble using wordpress functions in a pop-up modal form
- Force string into signup form
- custom contact form no longer working (because of 3.2?)
- Data inserted in database, but ajax calls error function
- upload images on front by user using form
- Correct Syntax for uploading files to custom directory in WordPress
- ajax form function error
- How to pass username into form that sends data to database
- HOW TO Insert Existing PHP Code to WOrdPress
- Send foreach $_post method to contact form 7 [closed]
- php inside HTML via shortcode? [closed]
- Null value given when confirming email’s
- Where to put include php file?
- Use HTML Form Data in PHP Function – WordPress Admin Page
- Contact form with dynamic dropdown and filter
- WCFM Custom form
- rest_cannot_create_user – Sorry, you are not allowed to create new users. CURL WORDPRESS REST API
- Redirect loop upon installation of my plugin
- Field validation strlen works in php7.4 fails 8.1 [closed]
- Custom form that stores data in mysql database
- Embed PHP script into WP – what is the best way
- Add a custom user meta data on registration based on user email
- How do I do so that people can register on my wordpress site?
- Preventing script injections in HTML form
- Putting form result in my database
- Bulk data save in custom table
- Can’t insert into a database wordpress
- Help with commenting system
- Display endpoint’s return into a file (file_put_contents())
- How to create a form that display license key (and email it to user) after the user enter their email and 10 digit code?
- “Joined in” or “Member since” displayed on single store page and then using shortcode to add
- Quiz page template, checked attribute missing when option selected
- Send summary email from a form with wp_mail
- Validate a custom form with js and php
- Automatically populating a date parameter within a shortcode
- Custom PHP contact form issue
- Trouble getting wpdb to work – first time
- How can I process a form submission from an HTTP POST request?