Answers.Body: <p>You say you want to change 'Edit Contact' - but if you mean, you want a way for a logged in user to be able to be directed 'somewhere' to update their details, then here is one non-coding solution suitable for just a couple of different roles that i hope others can improve on. (The more I wrote this out the more convoluted it seemed</p>
  
  <p>Ingredients:
  - one webform using webform_civicrm module per role
  - one View with displays set for each role</p>
  
  <p>Recipe:
  Set the webforms up so cid1 is the logged in user, and provide the fields you want depending on the role for each webform.
  With the view make a block per role or use some php sauce so that the link that it provides varies per role. Stack the block(s) to show on /user perhaps.
  Set the link in the block to send the user to the webform that is relevant to their role.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-10T08:51:18.643Z
Answers.Text: Thank's pete, I just installed the webform and had a fast look. But I'm afraid, in this direction, my need are too complex. In my form I need, custom fields (eg. new "preferred methods" to put near the default ones), button for address autocomplete,  ajax call, ....
  I don't know if webform are enough powerful for that.
Answers.UserDisplayName: marcello
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-10T10:06:14.053Z
Answers.Text: perhaps you should expand your question then to fully explain what it is that you need to achieve. but have you read the webform_civicrm documentation. It has amazing abilities with civicrm custom data etc.
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-10T10:38:00.620Z
Answers.Text: Mainly what I need is: 1) create a custom template where custom fields are near standard ones 2) put some default values in some custom & standard fields 3) validate (with DB calls) some fields before submit 4) put an address validate/autocomplete routine (Google). I had a look at the documentation and make sone quick tests, but I'm not sure webforms can solve all my needs
Answers.UserDisplayName: marcello
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-10T18:51:13.583Z
Answers.Text: what do you mean by 'near standard ones'?
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-11T08:47:54.250Z
Answers.Text: eg. some custom "preferred methods" that in the form should be close to the standard ones
Answers.UserDisplayName: marcello
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-09T20:43:05.660Z
Answers.LastActivityDate: 2016-05-10T18:51:48.850Z
Answers.LastEditDate: 2016-05-10T18:51:48.850Z
Answers.UserDisplayName: petednz - fuzion
Answers.Body: <p>Try using webform_civicrm! </p>
  
  <ol>
  <li><p>make different webforms exposing different contact fields </p></li>
  <li><p>you can do that for multiple contacts (i.e. make it into a batch update screen!) </p>
  
  <ol start="3">
  <li>set the webform permissions such that different roles can submit the different forms</li>
  </ol></li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-09T12:31:52.437Z
Answers.LastActivityDate: 2016-05-09T12:31:52.437Z
Answers.UserDisplayName: KarinG - Semper IT
Answers.Body: <p>After some research and test I think to take the solution to work on the template. Something like this:</p>
  
  <pre><code>{php}
  global $user;
  $roles_array = $user-&gt;roles;
  if (array_key_exists(4,$roles_array)) {
    $this-&gt;assign('customtemplate', True);
  }
  {/php}
  {if $customtemplate} 
     ....
  </code></pre>
  
  <p>But I dony'know if it will lower levels of security,</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-11T08:56:16.550Z
Answers.LastActivityDate: 2016-05-11T08:56:16.550Z
Answers.UserDisplayName: marcello
Body: <p>I want to customize the "Edit Contact" form depending on roles.
  What's the best way to do it?</p>
  
  <ul>
  <li>create different templates. It's possible to distinguish inside a .tpl the user role?</li>
  <li>create a Drupal view</li>
  <li>....</li>
  </ul>
  
  <p>Thank's a lot</p>
  
Tags: <templates><roles><contact-view>
Title: Different forms depending on user roles
ThreadText: # Different forms depending on user roles
  
  (Asked by: username_0 on 2016-05-09)
  
  I want to customize the "Edit Contact" form depending on roles.
  What's the best way to do it?
  
  * create different templates. It's possible to distinguish inside a .tpl the user role?
  * create a Drupal view
  * ....
  
  Thank's a lot
  
  **Tags:** templates, roles, contact-view
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2016-05-09. Score: 4
  
  You say you want to change 'Edit Contact' - but if you mean, you want a way for a logged in user to be able to be directed 'somewhere' to update their details, then here is one non-coding solution suitable for just a couple of different roles that i hope others can improve on. (The more I wrote this out the more convoluted it seemed
  
  Ingredients:
  - one webform using webform\_civicrm module per role
  - one View with displays set for each role
  
  Recipe:
  Set the webforms up so cid1 is the logged in user, and provide the fields you want depending on the role for each webform.
  With the view make a block per role or use some php sauce so that the link that it provides varies per role. Stack the block(s) to show on /user perhaps.
  Set the link in the block to send the user to the webform that is relevant to their role.
  
  > **Comments:**
  > **username_0**: Thank's pete, I just installed the webform and had a fast look. But I'm afraid, in this direction, my need are too complex. In my form I need, custom fields (eg. new "preferred methods" to put near the default ones), button for address autocomplete,  ajax call, .... I don't know if webform are enough powerful for that.  
  > **username_1**: perhaps you should expand your question then to fully explain what it is that you need to achieve. but have you read the webform_civicrm documentation. It has amazing abilities with civicrm custom data etc.  
  > **username_0**: Mainly what I need is: 1) create a custom template where custom fields are near standard ones 2) put some default values in some custom & standard fields 3) validate (with DB calls) some fields before submit 4) put an address validate/autocomplete routine (Google). I had a look at the documentation and make sone quick tests, but I'm not sure webforms can solve all my needs  
  > **username_1**: what do you mean by 'near standard ones'?  
  > **username_0**: eg. some custom "preferred methods" that in the form should be close to the standard ones  
  
  ---
  
  ### Answer by username_2 on 2016-05-09. Score: 2
  
  Try using webform\_civicrm!
  
  1. make different webforms exposing different contact fields
  2. you can do that for multiple contacts (i.e. make it into a batch update screen!)
  
     3. set the webform permissions such that different roles can submit the different forms
  
  
  ---
  
  ### Answer by username_0 on 2016-05-11. Score: 0
  
  After some research and test I think to take the solution to work on the template. Something like this:
  {php}
  global $user;
  $roles_array = $user->roles;
  if (array_key_exists(4,$roles_array)) {
    $this->assign('customtemplate', True);
  }
  {/php}
  {if $customtemplate} 
     ....
  
  But I dony'know if it will lower levels of security,
  
  
  ---
  
  