Support » Plugins » Add User Page when new user registers

  • Resolved thekruser

    (@thekruser)


    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.

Viewing 1 replies (of 1 total)
  • Never mind. Figured it out. I was putting it in the funtions.php of the in wp-includes folder. It goes in the functions.php of the theme.

Viewing 1 replies (of 1 total)
  • The topic ‘Add User Page when new user registers’ is closed to new replies.