Custom Function When Add User
-
Hi All,
Im searching all over codex, google and forum to create a custom function when adding users in wordpress, but im a new coder.
Can anyone help me with this:When creating a user, automaticly create a category with username, page with username and custom template.
Im new to php and wordpress, dont know exactly were to add these functions.
lines 1593 – 1602 – wp-includes/users.php
function wp_create_user($username, $password, $email = '') { $user_login = esc_sql( $username ); $user_email = esc_sql( $email ); $user_pass = $password; // create a category with username wp_create_category( $username ); // create page with username and theme? $my_page = array( 'post_title' => '$username', 'post_content' => '[list category=$username]', 'post_status' => 'publish', 'post_author' => 1, //didnt find this function above //'page_template' => 'portal.php', ); // Insert the post into the database wp_insert_post( $my_page ); $userdata = compact('user_login', 'user_email', 'user_pass'); return wp_insert_user($userdata); }
If someone can help me or have a better solution i buy a beer!
Thanks
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Custom Function When Add User’ is closed to new replies.