Answers.Body: <p>I found I could do this painlessly using <a href="https://civicrm.org/blogs/erikhommel/extension-civirules-now-avaible-download-live-showcase-maf-norge" rel="nofollow">CiviRules</a>. I edited the profile to include automatic assignment to a group, then created a rule to assign a tag to anyone being added to that group.</p>
  
  <p>The CiviRules extension looks like it will be very useful.   </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-11T04:40:49.150Z
Answers.LastActivityDate: 2015-07-11T11:27:39.747Z
Answers.LastEditDate: 2015-07-11T11:27:39.747Z
Answers.UserDisplayName: JoAnne
Answers.Body: <p>You could set up a drupal webform to accomplish this. A webform can do everything a standalone profile form can do, plus a lot more, including tagging.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-11T01:30:03.717Z
Answers.Text: See additional information in question that I forgot to include.
Answers.UserDisplayName: JoAnne
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-10T14:56:22.703Z
Answers.LastActivityDate: 2015-07-10T14:56:22.703Z
Answers.UserDisplayName: Coleman
Body: <p>Anyone who signs up online for a membership on our site must create a Drupal user account at the same time (advanced setting on profile used for membership sign up). This gives them access to member-only benefits.</p>
  
  <p>We want to make use of the ability for logged in users to complete a membership form on behalf of someone else (for our volunteers who take memberships from people using our helpline).</p>
  
  <p>However, if a volunteer is logged in they can't create a Drupal User account for someone else.</p>
  
  <p>We can create a <a href="https://civicrm.org/blogs/petednz/creating-drupal-users-made-easy-single-or-multiple-contacts-civi-imports-and-webforms" rel="nofollow">drupal user for a civicrm contact just by tagging them</a>, but although a profile can be set to automatically add someone to a group, the ability to automatically tag someone doesn't exist.  Adding people to a group automatically then tagging them latter on based on that group membership is not ideal. </p>
  
  <p>Can a (post or postProcess?) hook be used to tag the new contact when a profile is submitted on a contribution page being filled in by another logged-in user?</p>
  
  <p>Additional information:</p>
  
  <p>It is a CiviCRM 4.4.16 / Drupal 7 site.</p>
  
  <p>These are paid memberships and we use pricesets due to our pricing structure, so I don't think switching to webforms is an easy option.  If we wanted to use webforms I think we would have to more than double the number of memberships types in the system and have some custom code rewritten. </p>
  
  <p>The profile I am referring to is on a contribution page for a paid membership that is specifically designed for volunteers to fill in on behalf of someone else. The profile is the main "Name and Address" profile on the page ie. the one that would usually be set to force someone to create a Drupal user account when they joined.  </p>
  
  <p>At the moment that is how the profile is set up - the person filling in the form must create a Drupal user account.  If a logged in volunteer tries to access this membership page they are forcibly logged out before they can start to fill in the form, so they are filling it in as if they are the  person joining up. </p>
  
  <p>I would like to remove the requirement that they must be logged out to sign up on behalf of a new member.  However, I need to have the Drupal User account created at the time the membership is submitted, so just adding "&amp;cid=0" to the membership form URL is not enough.</p>
  
  <p>I have seen Erik's blog on <a href="https://civicrm.org/blogs/erikhommel/extension-civirules-now-avaible-download-live-showcase-maf-norge" rel="nofollow">CiviRules</a> and think it may provide a solution, but as always, money is short and I have been put off by "We would recommend organizations to get a CiviCRM partner to assist them at least in the initial configuration and thinking about CiviRules.". I am looking to extend my (very limited) developer skills and thought an extension to implement a hook to do this might not be totally impossible for me.   </p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-10T21:19:57.187Z
Comments.Text: Where/How are your profiles being used Joanne
Comments.UserDisplayName: petednz - fuzion
Tags: <profile><webform-civicrm><groups><hooks><tags>
Title: How can I assign tag when certain profiles are submitted
ThreadText: # How can I assign tag when certain profiles are submitted
  
  (Asked by: username_0 on 2015-07-10)
  
  Anyone who signs up online for a membership on our site must create a Drupal user account at the same time (advanced setting on profile used for membership sign up). This gives them access to member-only benefits.
  
  We want to make use of the ability for logged in users to complete a membership form on behalf of someone else (for our volunteers who take memberships from people using our helpline).
  
  However, if a volunteer is logged in they can't create a Drupal User account for someone else.
  
  We can create a [drupal user for a civicrm contact just by tagging them](https://civicrm.org/blogs/username_1/creating-drupal-users-made-easy-single-or-multiple-contacts-civi-imports-and-webforms), but although a profile can be set to automatically add someone to a group, the ability to automatically tag someone doesn't exist. Adding people to a group automatically then tagging them latter on based on that group membership is not ideal.
  
  Can a (post or postProcess?) hook be used to tag the new contact when a profile is submitted on a contribution page being filled in by another logged-in user?
  
  Additional information:
  
  It is a CiviCRM 4.4.16 / Drupal 7 site.
  
  These are paid memberships and we use pricesets due to our pricing structure, so I don't think switching to webforms is an easy option. If we wanted to use webforms I think we would have to more than double the number of memberships types in the system and have some custom code rewritten.
  
  The profile I am referring to is on a contribution page for a paid membership that is specifically designed for volunteers to fill in on behalf of someone else. The profile is the main "Name and Address" profile on the page ie. the one that would usually be set to force someone to create a Drupal user account when they joined.
  
  At the moment that is how the profile is set up - the person filling in the form must create a Drupal user account. If a logged in volunteer tries to access this membership page they are forcibly logged out before they can start to fill in the form, so they are filling it in as if they are the person joining up.
  
  I would like to remove the requirement that they must be logged out to sign up on behalf of a new member. However, I need to have the Drupal User account created at the time the membership is submitted, so just adding "&cid=0" to the membership form URL is not enough.
  
  I have seen Erik's blog on [CiviRules](https://civicrm.org/blogs/erikhommel/extension-civirules-now-avaible-download-live-showcase-maf-norge) and think it may provide a solution, but as always, money is short and I have been put off by "We would recommend organizations to get a CiviCRM partner to assist them at least in the initial configuration and thinking about CiviRules.". I am looking to extend my (very limited) developer skills and thought an extension to implement a hook to do this might not be totally impossible for me.
  
  **Tags:** profile, webform-civicrm, groups, hooks, tags
  
  > **Comments:**
  > **username_1**: Where/How are your profiles being used username_0  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2015-07-11. Score: 2 | Accepted answer
  
  I found I could do this painlessly using [CiviRules](https://civicrm.org/blogs/erikhommel/extension-civirules-now-avaible-download-live-showcase-maf-norge). I edited the profile to include automatic assignment to a group, then created a rule to assign a tag to anyone being added to that group.
  
  The CiviRules extension looks like it will be very useful.
  
  
  ---
  
  ### Answer by username_2 on 2015-07-10. Score: 2
  
  You could set up a drupal webform to accomplish this. A webform can do everything a standalone profile form can do, plus a lot more, including tagging.
  
  > **Comments:**
  > **username_0**: See additional information in question that I forgot to include.  
  
  ---
  
  