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.

is it possible to insert a login form inside a custom post type form?

  1. rovillesarate
    Member

    Hi! Is it possible to insert a login form inside a form and set a conditional statement to show a registration form and a login form if user is not logged in? Let say I have a custom post type based form for submitting a directory or a job post. Inside the form are the required input field such as name, address, contact etc. then there will be a user validation if current user is logged in before submitting the posts.

    example:
    /////////////////////////////////////////////////////////////////////////////////
    if user is logged in then show submit button

    else if user is not logged in show
    //////////////////////////////////////////////////////////////////////////////////////////////
    LOG-IN REGISTER
    User Name: /////////////////////////// | User Name: /////////////////////
    Password: ////////////////////////// | Password: /////////////////////
    Forgot your Password [ Sign - in ] | Email: //////////////////////
    | [ REGISTER ]
    or Log-in with your Facebook |
    [ FB-Log-in] |
    or Log-in with your Twitter |
    [ TWITTER-Log-in] |

    ////////////////////////////////////////////////////////////////////////////////////////////////
    else if user is not logged in and is a first time user then allow user to register then redirect back to the form to finish fill in form to submit content.

    First Name: //////////////////////////////////////////
    Last Name: //////////////////////////////////////////
    Post Title: //////////////////////////////////////////
    Post Body: //////////////////////////////////////////
    Custom Fields://///////////////////////////////////////

    If user is registered and logged in then show [ SUBMIT ] Button to submit post? so its like there is two or three forms here connected in one form?

    Is it possible to call a form using the html tags field component and call the log-in form and the registration form then just insert a condition statement to show the submit button if the user is logged in?

    Posted 14 years ago on Wednesday June 29, 2011 | Permalink
  2. No, you can't embed a form inside another form. However, I think you can a lot of what you want to do using the gform_pre_render hook. Using this hook, you can use your custom logic to show and hide fields when needed. Following is the documentation page for this hook with an example.
    http://www.gravityhelp.com/documentation/page/Gform_pre_render

    Posted 14 years ago on Wednesday June 29, 2011 | Permalink