PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Assign new user to post when registration form submitted

  1. I have the user registration plugin installed ( V1.4 )

    The form I have has both user and post data. An anonymous user "signs up" and creates a post. Currently, the user is created and the post is created. However, the new user is not assigned to newly created post.

    I have not been able to figure out what hook to use in order to accomplish this.
    This is sort of what I want to do:
    http://www.gravityhelp.com/forums/topic/can-a-user-create-an-account-and-submit-post-with-the-same-form

    What I have so far:

    // set post type and publish status
    add_filter("gform_post_data", "ihearditbefore_gform_post_data", 10 , 2 );
    
    function ihearditbefore_gform_post_data( $post_data, $form ){
    
       $post_data['post_type'] = 'person';
       $post_data['post_status'] = 'publish';
       return $post_data;
    }

    I notice $form has a post_user [postAuthor] => 13 but it's always the same. I would need to change that somehow — via what hook?

    Posted 11 years ago on Thursday May 24, 2012 | Permalink
  2. See if this post helps you out, it sounds identical to your situation:

    http://gravitywiz.com/2012/04/25/set-registered-user-as-post-author/

    Posted 11 years ago on Thursday May 24, 2012 | Permalink
  3. Thank you for your help. Fixed.

    Posted 11 years ago on Thursday May 24, 2012 | Permalink