Advertisement
roberttolton

Craft CMS User Profile Edit

Feb 15th, 2017
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 4.39 KB | None | 0 0
  1. <form method="post" accept-charset="UTF-8" enctype="multipart/form-data">
  2.  
  3.     {{ getCsrfInput() }}
  4.     <input type="hidden" name="action" value="users/saveUser">
  5.     <input type="hidden" name="redirect" value="partners/view/{{ user.id }}">
  6.     <input type="hidden" name="userId" value="{{ user.id }}">
  7.  
  8.     {% macro errorList(errors) %}
  9.         {% if errors %}
  10.             <ul class="errors">
  11.                 {% for error in errors %}
  12.                     <li>{{ error }}</li>
  13.                 {% endfor %}
  14.             </ul>
  15.         {% endif %}
  16.     {% endmacro %}
  17.  
  18.     {% from _self import errorList %}
  19.  
  20.     <div class="row">
  21.         <div class="col-xs-12 col-sm-6">
  22.             <label for="firstName">First Name:</label>
  23.             <input id="firstName" name="firstName" autocomplete="off" type="text" data-parsley-required="true" value="{{ user.firstName }}">
  24.             {% if account is defined %}{{ errorList(account.getErrors('firstName')) }}{% endif %}
  25.         </div>
  26.         <div class="col-xs-12 col-sm-6">
  27.             <label for="lastName">Last Name:</label>
  28.             <input id="lastName" name="lastName" autocomplete="off" type="text" data-parsley-required="true" value="{{ user.lastName }}">
  29.             {% if account is defined %}{{ errorList(account.getErrors('lastName')) }}{% endif %}
  30.         </div>
  31.     </div>
  32.  
  33.     <div class="row">
  34.         <div class="col-xs-12">
  35.             <label for="email">Email:</label>
  36.             <input id="email" name="email" autocomplete="off" type="email" data-parsley-required="true" data-parsley-type="email" value="{{ user.email }}">
  37.             {% if account is defined %}{{ errorList(account.getErrors('email')) }}{% endif %}
  38.         </div>
  39.     </div>
  40.  
  41.     <div class="row">
  42.         <div class="col-xs-12 col-sm-6">
  43.             <label for="fields[userPosition]">Position:</label>
  44.             <input id="userPosition" name="fields[userPosition]" autocomplete="off" type="text" data-parsley-required="true" value="{{ user.userPosition }}">
  45.             {% if account is defined %}{{ errorList(account.getErrors('userPosition')) }}{% endif %}
  46.         </div>
  47.         <div class="col-xs-12 col-sm-6">
  48.             <label for="fields[userCompany]">Company:</label>
  49.             <input id="userCompany" name="fields[userCompany]" autocomplete="off" type="text" data-parsley-required="true" value="{{ user.userCompany }}">
  50.             {% if account is defined %}{{ errorList(account.getErrors('userCompany')) }}{% endif %}
  51.         </div>
  52.     </div>
  53.  
  54.     <div class="row">
  55.         <div class="col-xs-12">
  56.             <label for="userPhoto">User Photo:</label>
  57.             {% if user.photoUrl %}
  58.                 <img src="{{ userPhotoUrl }}" id="userPhoto" width="100" height="100" />
  59.                 <input type="hidden" name="deleteUserPhoto" id="input-delete-user-photo" value="">
  60.             {% else %}
  61.                 <img src="{{ userPhotoUrl }}" width="100" height="100"  alt="No User Photo" />
  62.             {% endif %}
  63.                 <input id="profilePhoto" type="file" accept="image/*" capture="camera" name="userPhoto" value="{{ (user.photoUrl ? 'Change Photo' : 'Upload') }}">
  64.             {% if user.photoUrl %}
  65.                 <a id="btn-delete-user-photo" class="btn btn-solid btn-xs">Delete</a>
  66.             {% endif %}
  67.             {% if account is defined %}{{ errorList(account.getErrors('userPhoto')) }}{% endif %}
  68.         </div>
  69.     </div>
  70.  
  71.     {% includeJsResource "lib/redactor/redactor.js" %}
  72.     {% includeCssResource "lib/redactor/redactor.css" %}
  73.  
  74.     <div class="row">
  75.         <div class="col-xs-12">
  76.             <label for="userDescription">User Description:</label>
  77.             <textarea id="userDescription" name="fields[userDescription]" autocomplete="off" data-parsley-required="true">{{ user.userDescription }}</textarea>
  78.             {% if account is defined %}{{ errorList(account.getErrors('userDescription')) }}{% endif %}
  79.         </div>
  80.     </div>
  81.  
  82.     <div class="row">
  83.         <div class="col-xs-12">
  84.             <label for="userSpecialisms">User Specialisms:</label>
  85.             <textarea id="userSpecialisms" name="fields[userSpecialisms]" autocomplete="off" data-parsley-required="true">{{ user.userSpecialisms }}</textarea>
  86.             {% if account is defined %}{{ errorList(account.getErrors('userSpecialisms')) }}{% endif %}
  87.         </div>
  88.     </div>
  89.  
  90.     <button type="submit" class="btn btn-solid">Save</button>
  91.  
  92. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement