very last action before during user registration before he is redirected to homepage
What hook is the social plugin using? If it’s also user_register, just delay your handler: add_action( ‘user_register’, ‘register_referral’, 500 );
What hook is the social plugin using? If it’s also user_register, just delay your handler: add_action( ‘user_register’, ‘register_referral’, 500 );
Welcome to WPSE. You can use wp_insert_user, you don’t need to hook onto anything. Assuming here they fill out a form with a name, username, email and password field, and you capture it however you want. $name_array = explode(‘ ‘,$_POST[‘name’]); $user = array( ‘user_login’ => $_POST[‘username’], ‘user_pass’ => $_POST[‘password’], ‘user_email’ => $_POST[’email’], ‘first_name’ => $name_array[0], … Read more
The function that generates the new user notification is wp_new_user_notification(). It is called by another (similarly named) function wp_new_user_notifications() which is triggered by the action hook register_new_user in the register_new_user() function. If you follow that (or even if you don’t), all you need to do is remove the wp_new_user_notifications() filter from the register_new_user action: add_action( … Read more
The following code creates a new role. In fact is simply clones the subscriber role, so if you are not using that role currently, you may as well just use that. The following function need only be run once (it run’s when a user is ‘admin side’) //Creates a custom role called ‘my_new_role’. //Run this … Read more
Very similar to this question of a couple of hours ago: How can I get a list of latest posts outside of my WP install? Use chdir() to move into WordPress root before including and even calling anything related to WordPress. The are cases where relative directory and file references are used, thus breaking many … Read more
There is the action hook user_register that is called immediately after a user is added to the database. The user id is passed to the hook as an argument. You can use wp_insert_post to insert a new post in that action. You just need to get the relevant info from the user and add it … Read more
Proper hooks for login and register actions: <?php function custom_plugin_hooks() { add_action( ‘login_form’, ‘custom_plugin_form_inputs’ ); add_filter( ‘authenticate’, ‘custom_plugin_login_check’, 100, 3 ); add_action( ‘register_form’, ‘custom_plugin_form_inputs’ ); add_action( ‘register_post’, ‘custom_plugin_registration_check’, 100, 3); } custom_plugin_hooks(); function custom_plugin_form_inputs() { echo “\n”.'<p>’; echo ‘<label>Custom input: <br />’; echo ‘<input type=”text” name=”custom-input” class=”input” value=”” />’; echo ‘</label></p>’.”\n”; } function custom_plugin_login_check($user, $username, … Read more
Ok, first you the register_form action hook is applied to the default WP registration form, so keep this in mind if you don’t use that. Secondly, the add_action is calling an unknown function. So most likely this is why it’s not working. So here’s the corrected code. With added validation with error messages. //create a … Read more
Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted. You could use plugin Pie Register for the invitation codes or have look at this snippet ( Creating a Closed WordPress Community Using Referral … Read more
Please take a look at user_register hook This is fired when a new user is registered and conveniently passes you the user ID of the new user. function function_name( $user_id ) { /* do what you want to do with ID here */ } add_action( ‘user_register’, ‘function_name’);