Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Best practices for plugin user settings

Discussion in 'cPanel Developers' started by CloudNexus, May 18, 2018.

  1. CloudNexus

    CloudNexus Member

    Joined:
    May 18, 2018
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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.
     
  2. 24x7server

    24x7server Well-Known Member

    Joined:
    Apr 17, 2013
    Messages:
    1,785
    Likes Received:
    82
    Trophy Points:
    78
    Location:
    India
    cPanel Access Level:
    Root Administrator
    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..
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. CloudNexus

    CloudNexus Member

    Joined:
    May 18, 2018
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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 :)
     
  4. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    1,342
    Likes Received:
    89
    Trophy Points:
    103
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. CloudNexus

    CloudNexus Member

    Joined:
    May 18, 2018
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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!
     
  6. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    1,342
    Likes Received:
    89
    Trophy Points:
    103
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    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 :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice