The following warnings occurred: | ||||||||||||
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
|
Delete Users SQL Logic - Printable Version +- UserSpice (https://userspice.com/forums) +-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23) +--- Forum: UserSpice 4.3 and Below (https://userspice.com/forums/forumdisplay.php?fid=26) +--- Thread: Delete Users SQL Logic (/showthread.php?tid=178) |
Delete Users SQL Logic - rukichirimoshi - 06-30-2016 Hello! I'm using UserSpice for about a month now, making some changes (will post later in the "Modifications and Hackery") and I found something that I want to share with you guys. The problem is if you delete an user, can happen that it won't delete the permission_matches/profile entries. In the us_helpers.php we have a method for deletion of users, in the queries you find: $query1 = $db->query("DELETE FROM users WHERE id = ?",array($id)); $query2 = $db->query("DELETE FROM user_permission_matches WHERE id = ?",array($id)); $query3 = $db->query("DELETE FROM profiles WHERE id = ?",array($id)); But, for the query2/query3 I think it should be "user_id", instead of just "id". The version of UserSpice that I'm using is 4.1.2. I liked a lot UserSpice and also learned a lot with the codes of it! Please keep up with this good work! PS: Sorry about my english, it's not my first language. Greetings from Brazil. o/ Regards, Rukichirimoshi Delete Users SQL Logic - mudmin - 07-01-2016 Thank you so much! You are right. I have been meaning to take a look at that, and it slipped my mind. Your code looks great to me (so does your English). I will update our code. I'm glad you're enjoying userspice and finding it helpful! Delete Users SQL Logic - rukichirimoshi - 07-01-2016 Thanks for answering me, @mudmin. I also found the same problem in the "deletePermission" method (instead of "id", should be "permission_id"). Again, thank you! Delete Users SQL Logic - brian - 07-09-2016 I have implemented those fixes. Thanks for those. Delete Users SQL Logic - firestorm - 08-23-2016 i know its a little old but was those fixes done for the 4.1.3 release ? also i noticed when deleting a user we get the success message but the rest of the page fails to load, so after success but before add new user form its choking somewhere, ive looked hard but cant see where the issue is, has anyone notice this issue ? you also notice that the dropdown menu no longer works when it happens Delete Users SQL Logic - mudmin - 08-24-2016 Hmm. I've recorded this in the bug tracker. I'm hoping to push out a few bug fixes by early next week. I'll be looking for a solution. If you happen to find one in the mean time, PLEASE let me know! Delete Users SQL Logic - firestorm - 08-24-2016 awesome, i think I've got it working, may not be the best way but seems to work, in admin_users.php find `if($validation->passed()) { $form_valid = TRUE; try { $fields=array( 'username' => Input::get('username'), 'fname' => Input::get('fname'), 'lname' => Input::get('lname'), 'email' => Input::get('email'), 'password' => password_hash(Input::get('password'), PASSWORD_BCRYPT, array('cost' => 12)), 'permissions' => 1, 'account_owner' => 1, 'stripe_cust_id' => '', 'join_date' => $join_date, 'company' => Input::get('company'), 'email_verified' => 1, 'active' => 1, 'vericode' => 111111, ); $db->insert('users',$fields); $theNewId=$db->lastId(); $addNewPermission = array('user_id' => $theNewId, 'permission_id' => $perm); $db->insert('user_permission_matches',$addNewPermission); } catch (Exception $e) { die($e->getMessage()); } }else{ $val_err = display_errors($validation->errors()); }` notice above yours won't have the else statement, so add that into your file, now further down the page find the add new users form add replace: if (!$form_valid && Input::exists()){ echo display_errors($validation->errors()); }` with: Code: echo $val_err; this should fix it, see below: |