Hi there 🙂
I’m writing a plugin that will generate a draft post upon registration of a new user, and set the newly-registered user as the post author. I’m using the latest free version of PR with Paypal gateway enabled and added to my registration form. Registration goes as it should, the user is redirected to Paypal, finishes the payment, and is dropped back at my site. The user is created with no issue, but the post is not being generated.
I’ve tested with PR active, but WITHOUT the Paypal gateway enabled and on the reg form, and that DOES generate the post on registration. I’ve narrowed the issue down to the Paypal being on the reg form.
My code is as follows. Is there another action I need to be using to replace user_register
? What is PR doing that’s causing it not to fire correctly?
TIA!
add_action( 'user_register', 'restaurant_profile_create', 10, 1 );
function restaurant_profile_create( $user_id )
{
// Get user info
$user_meta = get_user_meta( $user_id, 'pie_text_7', true );
// Create a new post
$user_post = array(
'post_author' => $user_id,
'post_title' => $user_meta,
'post_content' => print_r( $user_meta, true ),
'post_type' => 'post',
);
// Insert the post into the database
$post_id = wp_insert_post( $user_post );
}