diff options
author | Malf Furious <m@lfurio.us> | 2016-05-22 02:50:17 -0400 |
---|---|---|
committer | Malf Furious <m@lfurio.us> | 2016-05-22 02:50:17 -0400 |
commit | 5f99922eb6fbda82da55ccf728eda6add48cb4f1 (patch) | |
tree | e1cc33327d430a19e6f0a33bff48946139456798 | |
parent | a99a0afd57a109f581c676b8dd3622dd3e901553 (diff) | |
download | scrott-5f99922eb6fbda82da55ccf728eda6add48cb4f1.tar.gz scrott-5f99922eb6fbda82da55ccf728eda6add48cb4f1.zip |
Add function User::getNumAdmins()
Function to count the number of admin accounts that exist. This is used
to make sure that while deleteing accounts, the number of administrators
never drops to zero.
-rw-r--r-- | app/class/user.class.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/class/user.class.php b/app/class/user.class.php index 1d17dfe..07bd0d6 100644 --- a/app/class/user.class.php +++ b/app/class/user.class.php @@ -75,6 +75,16 @@ class User extends Object } /* + * Get the number of administrative accounts in the system + */ + function getNumAdmins() + { + $query = "SELECT count(*) as cnt FROM user WHERE admin = 1"; + $results = $this->db->query($query); + return $results[0]['cnt']; + } + + /* * Check whether a given username is currently in use */ function usernameInUse($username) |