The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.28 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.28 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.28 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.28 (Linux)
File Line Function
/global.php 909 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1370 fetch_forum_permissions
/printthread.php 76 forum_permissions
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.28 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.28 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.28 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.28 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Form Tools
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. Smile 


RE: If-statement | Edit Admin Menu Options - Ben - Dec 15th, 2017

Hi Zdragon1,

Welcome! And thanks for the post. Smile

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