mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
[Welcome] Claim Notes, API Keys
This commit is contained in:
@@ -41,6 +41,27 @@ class Note extends CI_Model {
|
||||
return $this->db->get('notes');
|
||||
}
|
||||
|
||||
function ClaimAllNotes($id = NULL) {
|
||||
// if $id is empty then use session user_id
|
||||
if (empty($id)) {
|
||||
// Get the first USER ID from user table in the database
|
||||
$id = $this->db->get("users")->row()->user_id;
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'user_id' => $id,
|
||||
);
|
||||
|
||||
$this->db->update('notes', $data);
|
||||
}
|
||||
|
||||
function CountAllNotes() {
|
||||
// count all notes
|
||||
// where user_id is not NULL
|
||||
$this->db->where('user_id !=', NULL);
|
||||
return $this->db->count_all('notes');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user