For developers

Dealing with sandbox removal

When the sandbox is removed, all default WordPress tables are also deleted. But if there are any custom WordPress plugin or theme tables, you should remove them manually.

/*
  Plugin Name: MotoPress Demo - Delete Custom Tables
  Plugin URI: https://motopress.com
  Description: This plugin allows you to indicate what custom tables should be deleted along with sandbox removal.
  Author: MotoPress
  Version: 1.0
  Author URI: https://motopress.com
*/
function demo_delete_my_custom_tables( $tables ) {
  global $wpdb;
  // add your tables here
  $tables[] = $wpdb->prefix . 'mprm_customer';
  /*$tables[] = $wpdb->prefix . 'woocommerce_log';
  ... */
  return $tables;
}
add_filter('wpmu_drop_tables', 'demo_delete_my_custom_tables');

Actions

  • mp_demo_before_sandbox_creation – This action runs before new demo creation (before email activation, adding to the MailChimp lists, and sending).
  • mp_demo_sandbox_creation – This action runs a new demo creation.
  • mp_demo_before_sandbox_redirect – This action runs before redirect into existing sandbox, if it exists.
  • mp_demo_sandbox_is_expired – Fired if a sandbox is expired.
  • mp_demo_secret_not_exists – Fired if a sandbox with this token is not found.
  • mp_demo_create_sandbox – Fired after a new sandbox is created. Passes one argument, the $id of the newly created blog.
  • mp_demo_toolbar_head – The mp_demo_toolbar_head action hook is triggered within the <head></head> section of the toolbar page template.
  • mp_demo_toolbar_list_before – This action runs at the top of the toolbar select list.
  • mp_demo_toolbar_list_after – This action runs after the last element of the toolbar select list.
  • mp_demo_toolbar_links – This action runs before toolbar button in the ul tag.
  • mp_demo_toolbar_footer – The mp_demo_toolbar_head action hook is triggered near the </body> tag of the toolbar page template.
  • mp_demo_delete_sandbox – Fires before a sandbox is deleted.
  • mp_demo_before_popup_link – This action runs before the Open popup button.
  • mp_demo_after_popup_link – This action runs after the Open popup button.
  • mp_demo_popup_before_content – This action runs before the Registration popup content.
  • mp_demo_popup_after_content – This action runs after the registration popup content.
  • mp_demo_form_before – This action runs before the registration form.
  • mp_demo_form_after – This action runs after the registration form.
  • 'admin_mp_demo_tabs_save-' . $currentTabId – This action runs on the Sandbox menu page saving.
  • 'admin_mp_demo_settings_save-' . $currentTabId – This action runs on the Settings menu page saving.
  • 'admin_mp_demo_blog_settings_save-' . $currentTabId – This action runs on the blog Restrictions menu page saving.

Filters

  • mp_demo_source_id – Provides blog ID to create demo from.
  • mp_demo_block_msg – Message shown to all users when a page has been disallowed.
  • mp_demo_allowed_pages – Passed an array Demo allowed pages.
  • mp_demo_allowed_subpages – Demo allowed subpages.
  • mp_demo_show_menu_pages – Passed an array of top-level menu pages that were white-listed in the Restrictions settings.
  • mp_demo_show_submenu_pages – Passed an array of submenu pages that were white-listed in the Restrictions settings.
  • mp_demo_check_sandbox_creation – This filter is ran new sandbox creation.
  • mp_demo_toolbar_theme – Use this action to change toolbar theme CSS class.
  • mp_demo_responsive_preview_url – Toolbar frame source url.
  • mp_demo_global_tables – An array of tables that should not be cloned when creating a new sandbox.
  • mp_demo_purge_sandbox – If it has been alive longer than the lifespan, delete the sandbox. If false is returned from the filter, the sandbox will not be purged.
  • mp_demo_sandbox_lifespan – This filter is passed the amount of sandbox lifetime allowed in seconds.
  • mp_user_name – This filter is passed the created user name.
  • mp_user_email – This filter is passed the created user email.
  • mp_user_password – This filter is passed the created user password.
  • mp_activate_plugin – When a new sandbox is created, active plugins are re-activated on the new sandbox site. This filter is ran individually for every active plugin and is passed a bool false.
  • mp_demo_create_redirect – After a sandbox has been successfully created, this is the url that the user will be redirected to. It is passed the address of the current site, along with the blog id for the newly created sandbox.
  • mp_demo_query_count – Plugin will attempt to insert this many database rows at once when cloning a source. Higher numbers will result in faster sandbox creation, but lower numbers are less prone to failure.
  • mp_demo_form_class – Try demo form CSS class.
  • mp_demo_form_submit_button_class – Shortcode form and popup submit button CSS class.
  • mp_demo_popup_form_class – Shortcode form in the popup CSS class.
  • mp_demo_max_sql_int – Integer number is used to specify the number of records to return.
  • mp_demo_sandbox_tabs – An array of the Sandbox page tabs.
  • mp_demo_settings_tabs – An array of the Settings page tabs.
  • mp_demo_blog_settings_tabs – An array of the Restrictions page tabs.
  • mp_demo_subsettings_tabs – An array of the Notifications subtabs.
  • mp_demo_statistics_tabs – An array of the Statistics page tabs.

Related Topics