• I’ve got a custom wordpress install where when a user signs up, a new page is created automatically. I’d like for that page to also be password protected, but want the password to be assigned as the password that gets defined when the user signs up. Here is the code for the automatic page creation when a user signs up..

    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’] = ‘Hi User

    [userupdates]

    [tab:BACKLINKS-ELGG] [table id=2 /]
    [tab:BACKLINKS-ARTICLE]
    [tab:END] Some more info goes here
    ‘;
    $my_post[‘post_status’] = ‘publish’;

    wp_insert_post( $my_post );

    }
    add_action(‘user_register’, ‘my_create_page’);

    Any ideas on what I could use to set the password as the users own password for that new page?

Viewing 1 replies (of 1 total)
  • Thread Starter jeeplaw

    (@jeeplaw)

    Ok, so I’ve narrowed it down to somehow including this into the above function..I just don’t know how?

    $visibility = ‘private’;
    $visibility_trans = __(‘Private’);

    and then also tying in the:

    $my_post[‘post_password’] = $user_password;

    To set the password…but I don’t know how to include the visibility statements into the function

    I guess the question is how do i programatically update this new post during creation to be password protected and define the password as the users own wordpress created password?

Viewing 1 replies (of 1 total)

The topic ‘Possible to set the password of a page to the users password automatically?’ is closed to new replies.