- Pie Register
2018-12-10 12:43:48

Reply To: action hook after registration

Home Forums Pie-Register 2.0 Support action hook after registration Reply To: action hook after registration

#5254

Ashley T
Participant

I’m also working on a plugin that will create a draft post when a user registers. Tried using pie_register_after_register as suggested in this thread, but it’s still not wanting to work.

I’ve narrowed it down to having the Paypal active and installed on the reg form. Draft post is created as expected without the Paypal gateway active. As soon as I activate and register another test user…no draft post.

I started my own topic on this, but haven’t had any bites yet. Any help is appreciated! My code is as follows:

add_action( 'pie_register_after_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 ); 
    
}