Jump to content
hansdesjarlais

Which hook should I use?

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?

Share this post


Link to post
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! 🙂

Share this post


Link to post
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'];

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

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