Answers.Body: <p>Have you experimented with the api explorer? </p>
  
  <p>As far as the API  is concerned on the wp demo site you will find a great explorer at <a href="http://wpmaster.demo.civicrm.org/wp-admin/admin.php?page=CiviCRM&amp;q=civicrm%2Fapi%2Fexplorer#explorer" rel="nofollow">http://wpmaster.demo.civicrm.org/wp-admin/admin.php?page=CiviCRM&amp;q=civicrm%2Fapi%2Fexplorer#explorer</a>.
  The URL will be similar for your own site.</p>
  
  <p>Remember, the eplorer is "live" so you should experiment on the demo site or on your test site, not your live site.</p>
  
  <p>As far as the rest is concerned, I am not a delevoper so I can't comment on whether what you want to do might be achievable or not, but it sounds rather like you intend to hack core and that is not recommended. An extension is the preferred approach. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-24T20:15:06.777Z
Answers.Text: I see how the api explorer works. I see no extensions for wordpress like the drupal webform extension. I need some way to override the built in contribution form for memberships. It's a multiple page form and I don't understand the data design or workflow. I could just copy the built in form, make the code changes, and put it in a custom directory, but how to invoke?
Answers.UserDisplayName: P a u l
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-24T13:06:57.807Z
Answers.LastActivityDate: 2016-04-24T13:06:57.807Z
Answers.UserDisplayName: JoAnne
Answers.Body: <p>You're mentioning using file overrides, but that's not maintainable in the long run - and is more complicated than it needs to be IMO.  </p>
  
  <p>I think a preferable approach is to create an extension that calls <a href="https://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_post" rel="nofollow">hook_civicrm_post</a> on the Membership entity.  Combine that with the API to edit the contact after the membership is created.</p>
  
  <p>This will allow you to set a contact subtype.  Changing the contact type is a little trickier because the fields that will be available aren't necessarily the fields you'd collect for a household.  But that's OK - because for a household membership, you probably want to keep an individual, then create a household separately, create a relationship between them, then move the membership on to the household.  You can do all this via the API.</p>
  
  <p>If you DO want to go the override route, <a href="https://wiki.civicrm.org/confluence/display/CRMDOC/Customize+Built-in,+Profile,+Contribution+and+Event+Registration+Screens" rel="nofollow">this page</a> shows how to override a single contribution page.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-25T18:18:17.503Z
Answers.Text: We will not use contact subtypes, no need for them. Everything we do is oriented around memberships. I need to find a tutorial and example extension for wordpress. Hooks appear to be like subscribing to events in c#, but I don't know where or how they are set up. The usage model for the  household contact has been a question for me... we have been assuming the head of household is implied, then additional individual contacts added later -- so your technique is more logical but there is nothing built in to support this -- the stock membership form is pretty limited.
Answers.UserDisplayName: P a u l
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-26T20:39:13.903Z
Answers.Text: @Paul You set up hooks in an extension.  The best practice is to set up the program civix, which generates the "skeleton" of your extension.  civix is here, but it assumes you're comfortable with the command line: https://github.com/totten/civix
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-25T00:59:45.243Z
Answers.LastActivityDate: 2016-04-25T00:59:45.243Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>The public facing membership signup (contribution) form (wordpress) will only create individual contacts. We need to control the type of contact created based on the membership type the user selects. If they select a 'Student' membership then we need an individual contact. If they choose a 'household' membership then we want a household contact to be created. Shouldn't be too hard to write, but I don't know where the code is or how the internal api works. What would be the most relevant php files to work with and what api commands are involved in contact creation?</p>
  
Tags: <wordpress><4.7>
Title: Need membership form mod to control contact creation
ThreadText: # Need membership form mod to control contact creation
  
  (Asked by: username_0 on 2016-04-23)
  
  The public facing membership signup (contribution) form (wordpress) will only create individual contacts. We need to control the type of contact created based on the membership type the user selects. If they select a 'Student' membership then we need an individual contact. If they choose a 'household' membership then we want a household contact to be created. Shouldn't be too hard to write, but I don't know where the code is or how the internal api works. What would be the most relevant php files to work with and what api commands are involved in contact creation?
  
  **Tags:** wordpress, 4.7
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-04-24. Score: 2
  
  Have you experimented with the api explorer?
  
  As far as the API is concerned on the wp demo site you will find a great explorer at <http://wpmaster.demo.civicrm.org/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fapi%2Fexplorer#explorer>.
  The URL will be similar for your own site.
  
  Remember, the eplorer is "live" so you should experiment on the demo site or on your test site, not your live site.
  
  As far as the rest is concerned, I am not a delevoper so I can't comment on whether what you want to do might be achievable or not, but it sounds rather like you intend to hack core and that is not recommended. An extension is the preferred approach.
  
  > **Comments:**
  > **username_0**: I see how the api explorer works. I see no extensions for wordpress like the drupal webform extension. I need some way to override the built in contribution form for memberships. It's a multiple page form and I don't understand the data design or workflow. I could just copy the built in form, make the code changes, and put it in a custom directory, but how to invoke?  
  
  ---
  
  ### Answer by username_2 on 2016-04-25. Score: 2
  
  You're mentioning using file overrides, but that's not maintainable in the long run - and is more complicated than it needs to be IMO.
  
  I think a preferable approach is to create an extension that calls [hook\_civicrm\_post](https://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_post) on the Membership entity. Combine that with the API to edit the contact after the membership is created.
  
  This will allow you to set a contact subtype. Changing the contact type is a little trickier because the fields that will be available aren't necessarily the fields you'd collect for a household. But that's OK - because for a household membership, you probably want to keep an individual, then create a household separately, create a relationship between them, then move the membership on to the household. You can do all this via the API.
  
  If you DO want to go the override route, [this page](https://wiki.civicrm.org/confluence/display/CRMDOC/Customize+Built-in,+Profile,+Contribution+and+Event+Registration+Screens) shows how to override a single contribution page.
  
  > **Comments:**
  > **username_0**: We will not use contact subtypes, no need for them. Everything we do is oriented around memberships. I need to find a tutorial and example extension for wordpress. Hooks appear to be like subscribing to events in c#, but I don't know where or how they are set up. The usage model for the  household contact has been a question for me... we have been assuming the head of household is implied, then additional individual contacts added later -- so your technique is more logical but there is nothing built in to support this -- the stock membership form is pretty limited.  
  > **username_2**: @username_0 You set up hooks in an extension.  The best practice is to set up the program civix, which generates the "skeleton" of your extension.  civix is here, but it assumes you're comfortable with the command line: https://github.com/totten/civix  
  
  ---
  
  