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

CloudNexus

Member
May 18, 2018
20
2
3
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!
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,274
1,292
313
Houston

CloudNexus

Member
May 18, 2018
20
2
3
Netherlands
cPanel Access Level
Root Administrator
HI @CloudNexus

The documentation on Package Extensions Data Behavior and Changes seems to address this, have you removed the package extensions from one of the packages and tested that way? Guide to Package Extensions - Data Behavior and Changes - Developer Documentation - cPanel Documentation
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.
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,274
1,292
313
Houston
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.
 

CloudNexus

Member
May 18, 2018
20
2
3
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!
 
  • Like
Reactions: cPanelLauren