The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.28 (Linux)
|
If-statement | Edit Admin Menu Options - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1) +--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5) +--- Thread: If-statement | Edit Admin Menu Options (/showthread.php?tid=30249) |
If-statement | Edit Admin Menu Options - Zdragon1 - Dec 12th, 2017 Hello everyone! I'm so glad to be here. My issue is simple: Form Tool’s design only allows admins to create new forms, not clients. The programs native design also only allows for one admin account which also has the power to delete and edit all other users. I need to be that admin. However, the office staff I’m working with needs to be able to create new forms for their use. To solve this issue I have found and implemented a workaround seen here. This has given my other users the power to create new forms but has also given them the power to edit the Form Tools settings. This risks them messing up my setup. I would simply edit the menu settings from within the program, but the critical settings in question (i.e. "settings") is required for all admin accounts. Hence, I cannot take this privilege away from them while still keeping the power to make new forms. I know some PHP and if I could get an if statement working and identify the user id I could ensure that no one but me could access the settings page. However, no function I have yet written has allowed for anything but crashing the page outright for all users. As I'm still new to Form Tools, I need some help understanding how to query and return the current logged in users account id or username so that I can make use of that information in the code. I also could use some help knowing where to put this code of mine. I will also be very willing to provide any further information asked of me to help clarify the issue and sort out any problems I haven't covered here. Any help would be very appreciated. And thank you all in advance, both for the help and for making such a powerful tool free for us to make use of. RE: If-statement | Edit Admin Menu Options - Ben - Dec 15th, 2017 Hi Zdragon1, Welcome! And thanks for the post. This is actually exactly what I'm planning on solving down the road with "user roles". The idea is that we'll no longer have specific hardcoded "admin" / "client" account types, but a much more flexible way to assign arbitrary permissions to user accounts. I think it'll solve your problem exactly. However it's still a ways off yet. I'm still working on wrapping up Form Tools 3 and that'll take another couple of months minimum. In the meantime I wish I had some advice... but I'm afraid Form Tools just wasn't really designed to be flexible in this regard. Sorry about that...! Ben |