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!

SOLVED Show or hide group of cPanel plugin based on package option

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

  1. CloudNexus

    CloudNexus Member

    Joined:
    May 18, 2018
    Messages:
    16
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Netherlands
    cPanel Access Level:
    Root Administrator
    For my plugin I've built a WHM package extension as described here ( Guide to Package Extensions - Developer Documentation - cPanel Documentation). This works fine, and I'm able to 'enable' my plugin for packages.

    On the front-end side of things I've built a cPanel plugin that registers itself in the way described here (Guide to cPanel Plugins - Add Plugins to Version 11.44 and Later - Developer Documentation - cPanel Documentation) with a custom group, and a number of 'icons' that link to my custom plugin pages. So far, so good.

    Problem however, is that this group is showing up for EVERY cpanel user, while the feature might not be enabled for the "package" they are currently assigned. Is there a way I can only 'show' the custom group of icons whenever the user has a specific package variable set to 'y' or something?

    Thanks!
     
  2. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    1,835
    Likes Received:
    134
    Trophy Points:
    118
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. CloudNexus

    CloudNexus Member

    Joined:
    May 18, 2018
    Messages:
    16
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Netherlands
    cPanel Access Level:
    Root Administrator
    Hi Lauren,

    I've checked out the document you've linked and it's basically giving developers a way to manually add package extensions. Please note that I have package extensions working properly in the way the devdocs describe it: with a tt2 file (Guide to Package Extensions - Default Settings Files - Developer Documentation - cPanel Documentation). The package extension shows up properly and works during account creation and WMH users can fill in the fields I require.

    My issue that I need this package variable should enable/disable a cPanel icon group on the FRONTEND side of things (so not in cPanel). This cPAnel group is my own (part of my product). If the feature hasn't been enabled for the user, the plugin shouldn't be visible for users.

    I think the best comparison would be this - my use case is nearly the same in a matter of speech.

    During account creation in WHM I "Disable" mysql for a given account as a package extension (note: I don't set it to 0 databases, I disable it completely). When I disable mysql for a given account (through his hosting package) I want to REMOVE the cPanel plugin group that is shown below from cPanel completely - the user doesn't have access to this feature, so it doesn't make sense to show this block of options if MySQL is disadbled for an account.

    upload_2018-6-20_0-5-49.png

    I hope I cleared up my question.
     
  4. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    1,835
    Likes Received:
    134
    Trophy Points:
    118
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi @CloudNexus


    The solution to removing the databases section is to remove all associated features in the feature manager. I removed MySQL, PHPMyAdmin, PostgreSQL, PHPPGAdmin from the feature list associated with my account. As you can see in the screenshot the group no longer exists within the cPanel account.
    groups.png
    Once creating your plugin and installing it with cPanel is the option for it not added to the feature manager? If it is added to the feature manager, to clarify does deselecting it from the feature list not remove it from the package? Like the rest of cPanel's features removing the associated features should remove the group though I am not aware of a function that will remove the entire group.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. CloudNexus

    CloudNexus Member

    Joined:
    May 18, 2018
    Messages:
    16
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Netherlands
    cPanel Access Level:
    Root Administrator
    Hi there Lauren.

    You are very right (of course you are) - I copy pasted the default sample of the install.json script where the 'featuremanager = false' was defined. So it never showed up in feature lists, and I never thought about this.

    You just fixed this for me...again!

    Thank you so much!
     
    cPanelLauren likes this.
  6. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    1,835
    Likes Received:
    134
    Trophy Points:
    118
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi @CloudNexus

    Awesome, you're very welcome! I'm so glad I was able to help! Thank you for letting us know what you did to resolve it as well :)
     
    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