Last active
September 28, 2016 02:15
-
-
Save speedguy/7213596 to your computer and use it in GitHub Desktop.
Using user_register hook in Wordpress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action('user_register', 'my_new_member'); | |
| function my_new_member($user_id) { | |
| global $wpdb; | |
| //Example of how to get the fields submitted via the form | |
| if (isset($_POST['first_name'])) { | |
| $firstname = $_POST['first_name']; | |
| } | |
| else { | |
| $firstname = ''; | |
| } | |
| //Adjust based on your specific columns | |
| $data = array ( | |
| 'user_id' => $user_id, | |
| 'first_name' => $firstname, | |
| ); | |
| //Adjust with name of your database table | |
| $wpdb->insert('wp_my_crm_data', $data); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Many thanks.
Note