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
- Genesis – Customize search form
- Integrating WordPress to my website, while keeping my own authentication system
- How to insert PHP code in a WordPress Post
- Inserting Gravity Form checkbox values into Advanced Custom Fields [closed]
- Has anyone tried putting PHP ActiveRecord on WordPress?
- Handling error states with admin_post
- Creating wordpress user registration form
- 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
- Why when I instantiate wp_error in a validation method my user registration method stops working?
- Passing the page ID to a login php script
- 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
- Anyway to output the registration form like the login form with wp_login_form()?
- Redirect to a different page through registration, depending on page
- Custom Form Processing Issue
- My form action url is being prepended with a directory that does not exists
- Custom profile field with birthday. Troubles with
- User management system similar to wordpress one?
- WooCommerce/WordPress: how hide entire table form after submit (Admin Dashboard)?
- How to store data from multiple forms using ajax and php
- How to use $query->set with post__in?
- Ajax loaded form replaces form action with Ajax url
- prevent default not stopping page refresh. Passing form information to and from php with ajax in a wordpress site
- Custom search results page not working with empty search
- How can I save unique user data on my site? [closed]
- user_profile_update_errors hook not executing
- Post + form + action + results on the same page
- Why Won’t My Inputs in a form with a Get method work together?
- Paypal form integration with wordpress registration form without plugin [closed]
- Input data from email form not going to JSON file
- How to get the value of input hidden html from text editor to custom page template?
- Contact form won’t submit
- Databases – Submitting data from inputs to database [closed]
- How to show a ‘correct’ message after submit a form?
- db converts decimal number wrong
- WordPress admin-ajax.php 400 bad request
- Ajax contact form return 0
- “operation successful” message
- Password minimum length in personal subscription [closed]
- Search WordPress using static html page
- Run a code only on theme activation only during first activation
- Fatal error: Call to undefined function register_new_user()
- How to put a form with php code into a variable or shortcode?
- How Can I Edit the Registration Code?
- WordPress shortcode returns the data before
- Shortcode to embed Edit Account form not working
- Form Submission Not Working In Custom Theme
- Capture form data in one function and use it in another function (same file)
- How to display success message correctly and delete it when the page is refreshed
- Using admin-post.php for admin form but it directs me to admin-post.php white screen
- Submitting a form, using Ajax, to run a SQL Select query based on user input from the form
- Search only working on front page (index) , not working on other pages
- Pass important values server-side when processing form
- WPDB secure custom form
- Adding attribute to the post.php form tag in wp-admin
- Front end file upload returning wrong attachment url
- WordPressUser Submission Form
- Page Options Saving But Not Updating In Backend
- Testing a Form’s Zipcode Field with Regular Expressions to Determine WordPress Page Behaviour
- Cascading dropdown select search based on Parent Page & Child Page
- HTML Form Question
- I want it to detect the duplicate comment and give a warning on the same page
- Updating user meta adds string count to value?
- PHP multiple forms, same page, isset($_POST[]) not working?
- “Class Not Found” in HTML Form Target PHP File that contains the class
- Uploading/integrating custom user registration page
- How to create a widget with a populated dropdown?
- Store user form submitted information in post type
- Implement jQuery Smart wizard
- Javascript / PHP – closing the loop
- How do I stop my form from adding code to current page URL instead of re-directing. Been stuck for days
- Updating the database after parsing CSV document
- Attaching an upload to a user
- Creating wordpress user registration form
- If input field has value Require another field – PHP
- 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
- Post from front end form to post_meta
- Accessing values entered via form – try again
- Nonce fail after second submit attempt
- Styling admin page rows in order of importance (checkboxes)
- Editing a WordPress plugin to add my own functionality
- Using Nonce for my Form
- Force string into signup form
- Data inserted in database, but ajax calls error function
- upload images on front by user using form
- How to pass username into form that sends data to database
- rest_cannot_create_user – Sorry, you are not allowed to create new users. CURL WORDPRESS REST API
- How do I do so that people can register on my wordpress site?
- Putting form result in my database
- Bulk data save in custom table