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