Skip to main content

Adding custom user config key for all users

Comments

4 comments

  • cPRex Jurassic Moderator
    Hey there! Can you let me know what the keys provide access to? In general, we don't support adding custom code to the users file, but I'm not 100% certain I understand the situation.
    0
  • sangeeths
    Hey there! Can you let me know what the keys provide access to? In general, we don't support adding custom code to the users file, but I'm not 100% certain I understand the situation.

    Hey, sure. The key help us determine the custom sections we define in the UI config file to show using if
    condition and $CPDATA
    . This is one of the main use cases. Besides this, we also include UI JS/CSS to add extra functionality, like showing modals/popovers etc and we have customizations based on our hosting partner. For example, a condition we use in the dynamicui file would look like: [CODE=json]"group_customsetup": { "attrs": { "width": "48", "height": "48", "grouporder": "-1", "file": "group_customsetup", "description": "$LANG{'Setup'}", "groupdesc": "$LANG{'Setup'}", "group": "customsetup", "subtype": "img", "imgtype": "icon", "type": "image", "if": "$CPDATA{'custom_setup_shown'}" } }
    0
  • cPanelTJ
    @sangeeths , We are actually working on a feature right now that will allow you to do a lot of what you're wanting in a supported fashion. This will be available starting in version 98. The concept of an "enhancement" will be created which can be assigned to an account. "Enhancements" will be registered and created through a plugin's install.json process, and then can be assigned to accounts in WHM Create Account, Modify Account, and through the WHM API (this data will be stored in the user file). cPanel's UAPI will have a function to check if the account has a specific enhancement assigned. Here is the question I have for you: Do you want these "certain functionalities" managed by the server admin or by your integration?
    0
  • sangeeths
    @sangeeths , We are actually working on a feature right now that will allow you to do a lot of what you're wanting in a supported fashion. This will be available starting in version 98. The concept of an "enhancement" will be created which can be assigned to an account. "Enhancements" will be registered and created through a plugin's install.json process, and then can be assigned to accounts in WHM Create Account, Modify Account, and through the WHM API (this data will be stored in the user file). cPanel's UAPI will have a function to check if the account has a specific enhancement assigned. Here is the question I have for you: Do you want these "certain functionalities" managed by the server admin or by your integration?

    Hey TJ, That's awesome that you're considering to add such features. The integration I work on applies to all cPanel user accounts"existing and new. The hosting provider basically installs our plugin and that's that. AFAIK, our plugin just affects cPanel, not WHM. Adding custom prefixed keys to user config files is done by us and not usually by server admins (unless something went wrong which is rare so far). We also have some remote functionality to modify just these keys if a user needs the UI to change or our integration totally disabled for some reason. We rely on the cPanel hooks to modify these custom keys as well at times. We provide certain "modes" through our integration which results in certain custom UI groups to appear or be hidden. The "mode" information is what we persist in the user file. This also helps the scripts we inject into cPanel front-end determine the right course of action via UAPI queries. To answer your question: it's definitely our integration that wants to manage these "enhancements", should we come to use them in the future.
    0

Please sign in to leave a comment.