Jump to content

Running PHP within WHMCS order forms / client area


Drecca

Recommended Posts

I have a developer significantly customizing my WHMCS install, and some features I wanted added (interface, mostly) are apparently not possible because WHMCS does not allow PHP to run within the client area / order form templates.

 

I'm not a developer so this is the first time I hear of this. Is there a way around this?

Link to comment
Share on other sites

WHMCS does allow the code, but it is turned off by default, and will likely be removed in future releases.

Without knowing specifics, it's kind of hard to make recommendations, but there is a way to assign variables to the WHMCS template after running php code, and yes, hooks will help you.

Link to comment
Share on other sites

depending on what your developer is trying to do, and where, Smarty might be another possible option - although if it needs to be written using PHP, then using hooks would be the better way... but Tom's correct that without details, it's hard to advise other than generally.

Link to comment
Share on other sites

Hi Guys,

 

Thanks for the feedback! Here's what I'm trying to do for now

 

1 - I have a very customized client theme. But I want to be able to show customers which page they are actually on by having the icon linked to that page lit up. I.e : If they're on the support page, I want the icon i have for "support" to be a different color. I know how to do this outside of WHMCS, but need PHP within WHMCS to recognize which page the customer is on to do it.

 

2 - I'm building a customized order form, and some functions rely on running PHP in them. Some of these include different calculations for line items. Domain checks, etc, not all of them available in WHMCS, so I want to be able to run some php code in there.

 

Doable?

Link to comment
Share on other sites

Hi Guys,

 

Thanks for the feedback! Here's what I'm trying to do for now

 

1 - I have a very customized client theme. But I want to be able to show customers which page they are actually on by having the icon linked to that page lit up. I.e : If they're on the support page, I want the icon i have for "support" to be a different color. I know how to do this outside of WHMCS, but need PHP within WHMCS to recognize which page the customer is on to do it.

 

2 - I'm building a customized order form, and some functions rely on running PHP in them. Some of these include different calculations for line items. Domain checks, etc, not all of them available in WHMCS, so I want to be able to run some php code in there.

 

Doable?

as I said before, you can use ActionHook function to run your PHP logic, then pass the result to smarty, so it will be the same as adding PHP in templates directly but more stable.

 

simple example:

 

<?php

add_hook("ClientAreaPage", 1, function($vars){

   if ($vars['filename']=="submitticket"){
       $pageIcon = "ticket.png";
   }

   return array("pageicon" => $pageIcon);
});

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated