I want to automatically add a 'user page' when a new user registers. for example, if someone registers with a user name of NewUser then I want there to be a page http://mydomain/newuser automatically generated. I have been searching forever and can't figure it out.
I tried what was listed in this thread, but it did not work and that thread is closed for comments. It suggested that you add the following to functions.php:
function my_create_page($user_id){
$the_user = get_userdata($user_id);
$new_user_name = $the_user->user_login;
$my_post = array();
$my_post['post_title'] = $new_user_name;
$my_post['post_type'] = 'post';
$my_post['post_content'] = '';
$my_post['post_status'] = 'publish';
wp_insert_post( $my_post );
}
add_action('user_register', 'my_create_page');
When I do, I get the following:
Fatal error: Call to undefined function add_action() in /***link***/wp-includes/functions.php on line 4501
Any help would be greatly appreciated.