The following warnings occurred: | ||||||||||||
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
|
Connect to another database and edit the rows as admin - Printable Version +- UserSpice (https://userspice.com/forums) +-- Forum: Miscellaneous (https://userspice.com/forums/forumdisplay.php?fid=28) +--- Forum: Off-topic Discussions (https://userspice.com/forums/forumdisplay.php?fid=10) +--- Thread: Connect to another database and edit the rows as admin (/showthread.php?tid=617) |
Connect to another database and edit the rows as admin - lilpanda - 06-29-2017 I have a table called "invoices" and as an admin I want to be able to edit the users invoices, I've tried repurposing the 'admin_user.php' but it keeps returning a 500 error. Please help. Connect to another database and edit the rows as admin - mudmin - 06-29-2017 So there are a few ways to do this, but what you are mainly going to want to do is to wrap the whole edit function in a hasPerm function. Let's say your table is being created. So in my situation, I only wanted someone with the permission level of admin OR purchaser to be able to see purchase requests that had been closed. Code: <?php if(hasPerm([2,103],$user->data()->id)){ ?> Code: <div class="col-sm-3"> Code: <a class="btn" href="purchaser_all_pr.php?closed=3">Show CLOSED UNRECORDED PRs</a><br> Code: </div> Code: <?php } ?> You would do the same thing for your edit button, and it wouldn't show up for anyone who didn't have the permission level of 2(admin) Connect to another database and edit the rows as admin - lilpanda - 06-30-2017 ok thank you very much |