$t->searchUsers = User::queryIDByUsername($filtered['ignore-username']); if (count($t->searchUsers) != 1) { throw new Exception('Could not find user'); } if (Ignore::isBlocked($user, $t->searchUsers[0])) { // User already blocked } else { $ignore = new Ignore(); $ignore->time = time(); $ignore->userId = $user->id; $ignore->targetId = $t->searchUsers[0]->id; $ignore->note = $filtered['ignore-note']; $id = $ignore->create(); if ($id) { $t->msg = 'User is now blocked'; } else { throw new Exception('Could not block user, please try again'); } } } if ($filtered['ignore-remove-submit'] and is_array($filtered['ignore-remove'])) { Ignore::removeIds($user, $filtered['ignore-remove']); }