Best practices for plugin user settings
Hi there,
For a new WHM/CPanel plugin I need to set some users settings, as this plugin can be enabled or disabled per user from WHM, in and turn users can choose to 'enable' the plugin for their hosting account. So basically these are shared settings between the WHM and CPanel side of things.
Hence I'm posting this thread: Basically I'd like to save a number of extra settings in the user account. Is there a facility in the CPanel API's where I can add 'additional' info to the user account? This way I'll be able to use cpanel 'account'-API's to get the information out.
If there's no such option, am I advised to just use my own configuration system within the plugin (folder-based in the plugin directory, for example) or is there a facility to help me with this?
Just looking for guidance, thanks in advance.
-
Hi, I think you can use WHMAPI2 for this job, but you will have to do your customization on this. If you could provide more information with an example, it would be better to have all of us understand the scenario better.. 0 -
All right, my bad (sorry for the lack of examples) Basically I'm building a feature that can be enabled on a per-account basis. Since this plugin is housed both in WHM (for enabling/disabling) and CPanel I need a way to share info between the two. I was wondering whether there is a simple way to store "settings" (a key value store or something) that I can use. If not I have to roll my own, which is fine but since I'm very new to developing for WHM/Cpanel I'm asking :) 0 -
Hi @CloudNexus The following might be helpful for you though I am not sure what "settings" specifically you're referencing trying to modify: Guide to WHM API 1 - Developer Documentation - cPanel Documentation Guide to UAPI - Developer Documentation - cPanel Documentation Guide to Testing Custom Code - cPanel API and UAPI Calls - Developer Documentation - cPanel Documentation 0 -
I ended up reading the developer documentation you linked me to, and I've opted for the package extensions to store 'information' on users' accounts. After a few weeks of building and reading the docs this question might've been a bit premature. Got the answers, thanks! 0 -
Hi @CloudNexus I'm glad to hear it helped and that you got the answers you were looking for in the documentation! Thanks for letting us know :) 0
Please sign in to leave a comment.
Comments
5 comments