WordPress.org

Ready to get started?Download WordPress

Forums

New User Creates Page With Content (1 post)

  1. IllumPhotos
    Member
    Posted 1 year ago #

    Hello everyone! I am working on modifying a theme to create a page with content once a user registers. I am having a bit of trouble inserting the username into a bit of the shortcode for the content of the pages. Here is what I have:

    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'] = 'page';
    	$my_post['post_content'] = '[O_U user_role="Administrator, $new_user_name"]Here is what we have on plaqcard.com right now. If it is blank below, it is because there is nothing new.</br></br>[cfdb-table form="$new_user_name" hide="Submitted From,Submitted Login"]</br></br></br>[hr top]</br></br></br>Here is where you can upload more content.</br></br>Simply fill out the form below and we will have it loaded to the site.</br></br>[contact-form-7 id="155" title="$the_user"][/O_U]';
    	$my_post['post_status'] = 'publish';
    	wp_insert_post( $my_post );
    }
    add_action('user_register', 'my_create_page');

    I can't seem to place the username within the content of the page. Please forgive my simplicity, but I cannot seem to find the answer.

    Thank you,

    Randall

Topic Closed

This topic has been closed to new replies.

About this Topic