Commit efe0c152 authored by Hugh Davenport's avatar Hugh Davenport

Add tags to user edit page

Bug #800926

Change-Id: I9c7a2a6c5c3a051e99e8caf59335d0e4d64bd8da
Signed-off-by: default avatarHugh Davenport <hugh@catalyst.net.nz>
parent f3cd4efe
......@@ -173,6 +173,16 @@ if (count($authinstances) > 1) {
}
$tags = get_column('usr_tag', 'tag', 'usr', $user->id);
$elements['tags'] = array(
'defaultvalue' => $tags,
'type' => 'tags',
'title' => get_string('tags'),
'description' => get_string('tagsdesc'),
'help' => true,
);
$elements['submit'] = array(
'type' => 'submit',
'value' => get_string('savechanges','admin'),
......@@ -366,8 +376,26 @@ function edituser_site_submit(Pieform $form, $values) {
unset($userobj);
}
db_begin();
update_record('usr', $user);
delete_records('usr_tag', 'usr', $user->id);
if (is_array($values['tags'])) {
foreach(array_unique($values['tags']) as $tag) {
if (empty($tag)) {
continue;
}
insert_record(
'usr_tag',
(object) array(
'usr' => $user->id,
'tag' => strtolower($tag),
)
);
}
}
db_commit();
redirect('/admin/users/edit.php?id='.$user->id);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment