Jump to content

Which hook should I use?


hansdesjarlais

Recommended Posts

Hello,

I am brand new to WHMCS and looking for some advice, so please forgive my ignorance.

I have developed a custom WordPress auto-installer plugin for cPanel.

I want to create a hook which will automatically install WordPress using my cPanel plugin upon successful account creation.

From what I have read two hooks have been suggested but I want to make sure I'm using the correct one, they are: ClientAdd and AfterModuleCreate.

Which one should I use?

Also, what is the best/recommend method for me to pass variables from WHMCS to my cPanel plugin to run the install?

Link to comment
Share on other sites

18 hours ago, hansdesjarlais said:

I have developed a custom WordPress auto-installer plugin for cPanel.

it might be helpful for you to take a look at the free WHMCS Softaculous addon which can also be used to install WordPress - the addon code isn't encrypted, so it should be useful for you to examine.

18 hours ago, hansdesjarlais said:

From what I have read two hooks have been suggested but I want to make sure I'm using the correct one, they are: ClientAdd and AfterModuleCreate.

it shouldn't be ClientAdd as that just adds a client to the WHMCS database, but the user should already have an account in WHMCS, or will automatically after ordering, so adding them should be unnecessary...

the Softaculous addon uses AfterModuleCreate which should be a clue as to which one to use! 🙂

Link to comment
Share on other sites

@brian! is this the correct way to get the parameters as variables from the AfterModuleCreate hook?

 

// Variables
$hostname = $vars['params']['serverhostname'];
$username = $vars['params']['username'];
$password = $vars['params']['password'];
$wp_admin_username = $vars['customfields']['Wordpress Admin Username'];
$wp_admin_password = $vars['customfields']['Wordpress Admin Password'];

 

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