WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Add User Page when new user registers (2 posts)

  1. thekruser
    Member
    Posted 3 years ago #

    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.

  2. thekruser
    Member
    Posted 3 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags