diff options
author | Florian Pritz <bluewind@xinu.at> | 2016-08-20 23:10:36 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2016-08-21 15:40:56 +0200 |
commit | 1ce6e4b4f78b633296db099acf8b18577906a6a4 (patch) | |
tree | 787859f0c54fde3971e045f1d5a6badd940086f3 /application/models/mmultipaste.php | |
parent | ce54c1b9c23f4bdb7b2525b8aab66a6ba11bda0d (diff) |
muser: Add delete_user()
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/models/mmultipaste.php')
-rw-r--r-- | application/models/mmultipaste.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/application/models/mmultipaste.php b/application/models/mmultipaste.php index deb01978e..d44454f52 100644 --- a/application/models/mmultipaste.php +++ b/application/models/mmultipaste.php @@ -108,6 +108,18 @@ class Mmultipaste extends CI_Model { return $this->config->item("upload_path")."/special/multipaste-tarballs/".substr(md5($id), 0, 3)."/$id.tar.gz"; } + public function delete_by_user($userid) + { + $query = $this->db->select("url_id") + ->where("user_id", $userid) + ->get("multipaste")->result_array(); + $ids = array_map(function ($a) {return $a['url_id'];}, $query); + + foreach ($ids as $id) { + $this->delete_id($id); + } + } + public function delete_id($id) { $this->db->where('url_id', $id) |