WPCloudDeploy Documentation

Action Hook: wpcd_command_wordpress-app_prepare_server_completed

do_action( “wpcd_command_{$this->get_app_name()}_{$base_command}_{$status}”, $id, $name );

This is a variable action hook whose name changes based on the status of the command being run.  See discussion below for more information.

Example Hook Names

do_action("wpcd_command_wordpress-app_prepare_server_completed", $id, $name );
do_action("wpcd_command_wordpress-app_install_wp_completed", $id, $name );
do_action("wpcd_command_wordpress-app_change_domain_completed", $id, $name );

Example Hook

add_action("wpcd_command_wordpress-app_prepare_server_completed", 'my_function', 10, 2 );
public function my_function( $id, $name ) { 
     //your code here 
}

Discussion

This hook is fired after a specific long-running command is completed. Long running commands are actions like deploying servers and websites (the ones that usually include the black ‘terminal’ screen.)

The name of the hook depends on the status and the app name being run.  For WordPress actions, the app name will always be wordpress-app.  The most common status you use will be completed.

  • $id is the post_id of the server or app custom post type record.
  • $name is the name of the command being run but it can also include a random number unique to the current process.

Reference

Located in:

  • Function: update_command_status
  • File: /includes/core/apps/class-wpcd-app.php

Other Notes

This hook is used in our SELL SERVER SUBSCRIPTIONS WITH WOOCOMMERCE add-on to send emails after a server has been deployed.

Availability

This hook is only available in WPCD versions 4.2.5 or later.

 

Share: