Custom WHM plugin loses left-hand WHM nav menu
Hi All!
I'm experimenting with a custom WHM Plugin (for the first time). I'm coding with PHP instead of CGI because I'm more familiar with PHP. My custom plugin name is appearing in the list of plugins in the WHM left-hand menu, all good.
My problem is that, when I click on the menu link, my script insists on opening up in the whole browser window, instead of like all the other plugins, where the left-hand menu remains in place. Strictly speaking, with all the other plugins, the left-hand menu first disappears, and then reappears (i.e. gets rebuilt), so it's not an iframe situation.
I've studied the .conf files of all the other plugins that are stored in /var/cpanel/apps directory, and my .conf files appear to be doing all the right/normal things. And it's being successfully registered, no errors, with register_appconfig. I'm also running /scripts/restartsrv_cpsrvd after successful registration.
One of the settings in my .conf file is: target=_self Some of the other plugin .conf files set this too, some don't. I've tried both setting and not setting this, doesn't work either way. Unless perhaps it's something to do with my plugin's PHP code? Perhaps it MUST be a CGI script instead?? It's in the /cgi folder, with all the other plugin files and folders.
I'm sure the solution is simple. I'm just not seeing it yet! Any help would be appreciated.
-
Hey hey! Personally, I have no idea, but I've reached out to the team and I'll let you know what I find!
0 -
I spoke with developers and they indicated this is actually normal behavior. For example, PHPMyAdmin opens the entire browser window and does not maintain the left navigation.
Tools like Imunify360 keep the navigation because they include a specific perl CGI file at whostmgr/docroot/cgi/imunify/handlers/index.cgi that calls Cpanel::Template::process_template() to use the navigation bar.
Does that give you enough details to work with? If you need more specific data, the best place for this discussion may be the Integration channel in the cPanel Discord.
0 -
OK, that makes sense, thanks for this, I'll give it a go.
I did ask this same question in the Integration channel in the cPanel Discord, but didn't get a response, hence asking here :-)
fyi I think that PHPMyAdmin opening in the entire window is the exception, not the rule. I've just checked all the 8 plugins that currently appear in the Plugins section in the left-hand nav, and all of them retain the left-hand nav.0 -
The issue might not be PHP versus CGI, but rather how the plugin is being served or integrated. Make sure your PHP script is outputting content in a way that WHM expects. You might need to ensure that your script is returning valid HTML content and that any headers or meta tags needed by WHM are correctly set. Double-check your .conf file for any discrepancies compared to other plugins, especially focusing on the service and url settings. Also, verify that your PHP script is located in the correct directory and has the appropriate permissions. If the problem persists, consider looking at the server logs for any additional hints or errors.
0 -
Thx Jonathan. I was attempting to do this as a little side-project, but have since moved on to other things. Might give this a go again another time.
IMHO webpros should be putting a lot more effort into encouraging a thriving marketplace for WHM, e.g. in these 3 overlapping areas:
1. Making it technically easier to do (lowering barriers to participation)
2. Providing common code snippets (e.g. in CGI and PHP) to get people started.
3. Improved documentation, case studies, etc.
A thriving marketplace is a win for everyone!0 -
We do have some documentation here, but I will say that unless you already know what to look for, it isn't that easy to find. For example, regarding header/footer for PHP applications, it is documented here:
Maybe a good start for this might be for us to host some example plugins on github somewhere for people to work with?
1 -
Hi Andy Baugh - yes, hosting some example plugins on github would be a good start.
Stating the obvious - pls focus on giving us the scaffolding, including basic/sample WHM-extending functionality which we can swap out with our own ideas.
I've got quite a few ideas of features/functions to extend WHM, but if I can't easily get past the basics, then I fall at the first hurdle and move on. (Disclaimer - I used to be a full-stack developer many years ago, but my skills are very rusty these days, but recently boosted/supported by ChatGPT/CoPilot!)
In other words, if you can dumb it down for someone like me, then (almost) anyone should be able to do it, which is exactly what you want! :-)0
Please sign in to leave a comment.
Comments
7 comments