Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Administrator rights cannot be set for users
Hi, I have a newly installed OpenDocMan on my CentOS and the website is being set ready. Under admin account, I tried to add new users and I would like assign some of them with admin rights. However, every time I checked the admin checkbox under the user profile and then submit, the system will prompt as update successfully. Then when I go back and display the user profile, the admin status shows as unchecked and it wont allow to perform admin task with that user. Appreciate if anyone can help on this.

I have verified this issue. I am working on a new release but in the mean time here is the fix for this issue:

diff --git a/user.php b/user.php
index d6b0b8b..360dd1b 100644
--- a/user.php
+++ b/user.php
@@ -254,12 +254,12 @@ elseif(isset($_POST['submit']) && 'Add User' == $_POST['submit'])

         // INSERT into admin
-        $userid = mysql_insert_id($GLOBALS['connection']);
+        $userid = $pdo->lastInsertId();;
         if (!isset($_POST['admin']))
-        $query = "INSERT INTO {$GLOBALS['CONFIG']['db_prefix']}admin (id, admin) VALUES('$userid', '$_POST[admin]')";
+        $query = "INSERT INTO {$GLOBALS['CONFIG']['db_prefix']}admin (id, admin) VALUES('$userid', '{$_POST['admin']}')";
         $result = mysql_query($query, $GLOBALS['connection']) or die ("Error in query: $query. " . mysql_error());
#3 release. This release includes bug fixes and enhancements. No database changes.

#175 - Admin setting doesn't stick
#174 - Permissions Links inconsistent between themes
#173 - add image/svg as standard document type

#171 - Feature - Add Bengali Language
#157 - Add DWG to mimetypes.php

Forum Jump:

Users browsing this thread: 1 Guest(s)