Best practices for plugin user settings

CloudNexus

Member
May 18, 2018
20
2
3
Netherlands
cPanel Access Level
Root Administrator
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.
 

24x7server

Well-Known Member
Apr 17, 2013
1,911
96
78
India
cPanel Access Level
Root Administrator
Twitter
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..
 

CloudNexus

Member
May 18, 2018
20
2
3
Netherlands
cPanel Access Level
Root Administrator
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 :)
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,271
313
Houston

CloudNexus

Member
May 18, 2018
20
2
3
Netherlands
cPanel Access Level
Root Administrator
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!