Guest User

Untitled

a guest
Nov 19th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. <select class="custom-select" name="roles">
  2. <option selected disabled>Choose a role</option>
  3. {% for role in siteinfo.roles if role.name != 'Admin' and role.name != 'Developer' %}
  4. <option name="role" value="1">{{role.name}}</option>
  5. {% endfor %}
  6. </select>
  7.  
  8. private function adduser($context)
  9. {
  10. $now = $context->utcnow(); # make sure time is in UTC
  11. $fdt = $context->formdata();
  12. $u = R::dispense('user');
  13. $u->login = $fdt->mustpost('login');
  14. $u->email = $fdt->mustpost('email');
  15. $u->active = 1;
  16. $u->confirm = 1;
  17. $u->joined = $now;
  18. R::store($u);
  19. $u->setpw($fdt->mustpost('password'));
  20. if ($fdt->post('admin', 0) == 1)
  21. {
  22. $u->addrole('Site', 'Admin', '', $now);
  23. }
  24. if ($fdt->post('devel', 0) == 1)
  25. {
  26. $u->addrole('Site', 'Developer', '', $now);
  27. }
  28. if ($fdt->post('roles', 0) == 1)
  29. {
  30. $u->addrole('Site', 'Student', '', $now);
  31. }
  32. echo $u->getID();
  33. }
Add Comment
Please, Sign In to add comment