Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <select class="custom-select" name="roles">
- <option selected disabled>Choose a role</option>
- {% for role in siteinfo.roles if role.name != 'Admin' and role.name != 'Developer' %}
- <option name="role" value="1">{{role.name}}</option>
- {% endfor %}
- </select>
- private function adduser($context)
- {
- $now = $context->utcnow(); # make sure time is in UTC
- $fdt = $context->formdata();
- $u = R::dispense('user');
- $u->login = $fdt->mustpost('login');
- $u->email = $fdt->mustpost('email');
- $u->active = 1;
- $u->confirm = 1;
- $u->joined = $now;
- R::store($u);
- $u->setpw($fdt->mustpost('password'));
- if ($fdt->post('admin', 0) == 1)
- {
- $u->addrole('Site', 'Admin', '', $now);
- }
- if ($fdt->post('devel', 0) == 1)
- {
- $u->addrole('Site', 'Developer', '', $now);
- }
- if ($fdt->post('roles', 0) == 1)
- {
- $u->addrole('Site', 'Student', '', $now);
- }
- echo $u->getID();
- }
Add Comment
Please, Sign In to add comment