Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Action and Filter hooks

ole edited this page Nov 9, 2019 · 1 revision

Action Hooks

ispconfig_options (v1.0.4)

Used to add additional configuration settings being stored in WPISPConfig3_Options wordpress option

wcinvoicepdf_order_period (used by wc-invoice-pdf)

Properly display and manage monthly or yearly periods in WooCommerce shopping cart when a WC_Product_Webspace product. The file ispconfig_wc_product_webspace.php for it and may be replaced with wc-invoice-pdf plugin in future

Filter Hooks

ispconfig_block_{action} (v1.4.0)

Allow a plugin to manage fields being added through wp-ispconfig3 blocks. The below action are available

  • action_create_client used to create client accounts
  • action_create_website used to create website base on an existing client
  • action_create_database used to create website and client
  • action_create_mail used to create an email action based on an exiting client
  • action_update_client used to update client information
  • action_update_client_bank used to update client bank account details

Below is an example plugin to take control on client update action while overwriting the client login to the current logged in user:

/*
Plugin Name: Ispconfig client2user
Plugin URI: https://github.com/ole1986/wp-ispconfig3
Description: Overwrite the ISPConfig client login to the logged in WP user.
Version: 1.0
Author: ole1986
License: GPL2
*/
add_filter('ispconfig_block_action_update_client', function($fields) {

    $user = wp_get_current_user();

    array_walk($fields, function(&$item) use($user) {
        if($item['id'] == 'client_username') $item['value'] = $user->user_login;
    });

    return $fields;
});
Clone this wiki locally