You just need to reorder your function. Create your user before you enter your post, then the 'post_author' => $user_id
field will actually have a value.
You just need to reorder your function. Create your user before you enter your post, then the 'post_author' => $user_id
field will actually have a value.