Filters

Overview

Filters enable the admin to modify/hook into certain aspects of the task being done. There are several Filters in Softaculous that you can take advantage of.

Note : Filters have been added since Softaculous version 4.7.9

The following guide will show you how the Server Admin can configure Filter Functions to customize the installation, upgrade, email and several other events.

  • SSH to your server and go to the following path:
/path/to/softaculous/enduser/hooks/
  • You can see the file filter.txt.
  • Rename the file to make it a PHP file as filter.php.
  • Uncomment the function that matches your requirement, add the code inside the function as per your requirements and save the file.
  • That’s it you have configured your filter.

insert_filter

  • We make use of insert_filter function to trigger a specific filter.
insert_filter(string $tag, string $function_to_add, int $priority, int $accepted_args);

Parameters

ParamTypeDescription
$tagstring/RequiredAction name that triggers the specific function.
$function_to_addstring/RequiredName of the function to be triggered.
$priorityint/optionalPriority in which you want the filter to be triggered. (Default is 10)
$accepted_argsint/optionalNumber of arguments accepted by the filter function. (Default is 1)

Example 
Following is the example describing how a filter is triggered by an action:

If you would like to make some changes whenever an error is triggered in Softaculous, you will have to rename the file filter.txt to filter.php and uncomment the following part and add the code in my_error_handle() function.

insert_filter('error_handle', 'my_error_handle', 1, 1);

function my_error_handle($error){
     // Add your custom code here
}

insert_filter adds the data added by you to Softaculous and when the appropriate event is triggered your respective function is called. For eg., in the above example, whenever the event error_handle occurs, function my_error_handle is called and the code inside the same is executed. 

pre_install

Description 
The pre_install filter will trigger your function before the installation process for any script is started.

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_pre_install:

insert_filter('pre_install', 'my_pre_install', 1); 
function my_pre_install(){ 
global $soft, $software, $globals; 
// Do stuff here e.g. is as follows
if($soft == 26){  
//Do things only if its WordPress
 }
} 

post_install

Description 
The post_install filter will trigger your function after a script is installed.

Parameters

KeyValueDescription
$installationarray/RequiredContains details of the installation.
Array (
[insid] => installation id
[sid] => script id
[ver] => installed version of script
[itime] => installation time
[softpath] => path to installation
[softurl] => installation URL
[softdb] => database name of installation
[softdbuser] => database user of installation
[softdbhost] => database host of installation
[softdbpass] => database password of installation
[dbprefix] => table prefix of installation
)

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_post_install:

insert_filter('post_install', 'my_post_install', 1, 1); 
// @param   array $installation Details of the new installation 
function my_post_install($installation){ 
global $soft, $software, $globals; 
// Do stuff here e.g. is as follows   
if($soft == 26){  
//Do things only if its WordPress 
 } 
} 

pre_mail

Description 

  • The pre_mail filter will trigger your function whenever any mail is sent via Softaculous (e.g installing scripts, removing installation, etc).
  • The main usage of this filter is if you want to send out a CUSTOM Email or want to perform any action before an email is sent. e.g. if an Admin does not want to send an EMAIL of the installation of a script or any other process, then the Admin can Disable Email forcefully using this filter.

Parameters

KeyValueDescription
$arrayarray/RequiredContains details of an Email which is being sent.
Array (
[0] => Array
(
[to] => Email of USER
[subject] => Email SUBJECT
[message] => Email BODY
)
)

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_pre_mail:

insert_filter('pre_mail', 'my_pre_mail', 1, 1);
 // @param array $array Details of the email to be sent. 
function my_pre_mail($array){ 
global $globals; ////////////////////////////////////////////////////////////////////////////////// 
// $array  - Will contain the Email Content which is being sent // //////////////////////////////////////////////////////////////////////////////////
 global $globals; 
foreach($array as $k => $v){                             
 if($v['to'] == USER_EMAIL){       
               // Do the STUFF                
 }                
 // Update the Email subject          
       $array[$k]['subject'] = 'My Custom Subject';        
 }        
 return $array; 
} 

pre_import

Description 
The pre_import filter will trigger your function right before an installation is being imported.

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_pre_import:

insert_filter('pre_import', 'my_pre_import', 1); 
function my_pre_import(){
 global $soft, $software, $globals; 
// Do stuff here e.g. is as follows 
if($soft == 26){  
//Do things only if its WordPress  
} 
} 

post_import

Description 
The post_import filter will trigger your function after an installation is imported.

Parameters

KeyValueDescription
$installationarray/RequiredContains details of the installation.
Array (
[insid] => installation id
[sid] => script id
[ver] => installed version of script
[itime] => installation time
[softpath] => path to installation
[softurl] => installation URL
[softdb] => database name of installation
[softdbuser] => database user of installation
[softdbhost] => database host of installation
[softdbpass] => database password of installation
)

Usage 
Uncomment the following part and add your code inside the function my_post_import:

insert_filter('post_import', 'my_post_import', 1, 1); 
// @param array   $installation Details of the installation imported
function my_post_import($installation){ 
global $soft, $software, $globals; 
// Do stuff here e.g. is as follows
 if($soft == 26){  
//Do things only if its WordPress  
}
} 

pre_upgrade

Description 
The pre_upgrade filter will trigger your function right before an installation is upgraded.

Parameters

KeyValueDescription
$installationarray/RequiredContains details of the installation.
Array (
[insid] => installation id
[sid] => script id
[ver] => installed version of script
[itime] => installation time
[softpath] => path to installation
[softurl] => installation URL
[softdb] => database name of installation
[softdbuser] => database user of installation
[softdbhost] => database host of installation
[softdbpass] => database password of installation
)

Usage 
Uncomment the following part and add your code inside the function my_pre_upgrade:

insert_filter('pre_upgrade', 'my_pre_upgrade', 1, 1); 
// @param    array $installation Details of the installation being upgraded 
function my_pre_upgrade($installation){ 
global $soft, $software, $globals; 
// Do stuff here e.g. is as follows 
if($soft == 26){
  //Do things only if its WordPress 
 }
 } 

post_upgrade

Description 
The post_upgrade filter will trigger your function after an installation is upgraded.

Parameters

KeyValueDescription
$installationarray/RequiredContains details of the installation.
Array (
[insid] => installation id
[sid] => script id
[ver] => installed version of script
[itime] => installation time
[softpath] => path to installation
[softurl] => installation URL
[softdb] => database name of installation
[softdbuser] => database user of installation
[softdbhost] => database host of installation
[softdbpass] => database password of installation )

Usage 
Uncomment the following part and add your code inside the function my_post_upgrade:

insert_filter('post_upgrade', 'my_post_upgrade', 1, 1); 
// @param    array $installation Details of the installation upgraded 
function my_post_upgrade($installation){ 
global $soft, $software, $globals; 
// Do stuff here e.g. is as follows 
if($soft == 26){
 //Do things only if its WordPress
 }
} 

pre_remove

Description 
The pre_remove filter will trigger your function right before an installation is removed.

Parameters

KeyValueDescription
$installationarray/RequiredContains details of the installation.
Array (
[insid] => installation id
[sid] => script id
[ver] => installed version of script
[itime] => installation time
[softpath] => path to installation
[softurl] => installation URL
[softdb] => database name of installation
[softdbuser] => database user of installation
[softdbhost] => database host of installation
[softdbpass] => database password of installation )

Usage 
Uncomment the following part and add your code inside the function my_pre_remove:

insert_filter('pre_remove', 'my_pre_remove', 1, 1); 
// @param  array $installation Details of the installation being removed 
function my_pre_remove($installation){ 
global $soft, $software, $globals;
// Do stuff here e.g. is as follows 
if($soft == 26){  
//Do things only if its WordPress
 }
}

post_remove

Description 
The post_remove filter will trigger your function after an installation is removed.

Parameters

KeyValueDescription
$installationarray/RequiredContains details of the installation.
Array (
[insid] => installation id
[sid] => script id
[ver] => installed version of script
[itime] => installation time
[softpath] => path to installation
[softurl] => installation URL
[softdb] => database name of installation
[softdbuser] => database user of installation
[softdbhost] => database host of installation
[softdbpass] => database password of installation )

Usage 
Uncomment the following part and add your code inside the function my_post_remove:

insert_filter('post_remove', 'my_post_remove', 1, 1); 
// @param  array $installation Details of the installation removed
function my_post_remove($installation){
 global $soft, $software, $globals;
 // Do stuff here e.g. is as follows 
if($soft == 26){ 
//Do things only if its WordPress
}
 } 

pre_clone

Description 
The pre_clone filter will trigger before the CLI clone process starts.

Usage 
Uncomment the following part and add your code inside the function my_pre_clone:

insert_filter('pre_clone', 'my_pre_clone', 1); 
function my_pre_clone(){ 
global $soft, $software, $globals; 
// Do stuff here e.g. is as follows 
if($soft == 26){ 
//Do things only if its WordPress 
} 
} 

pre_clone_cli

Description 
The pre_clone_cli filter will trigger your function before the clone process is started.

Note : This filter is available since Softaculous version 6.0.2

Parameters

KeyValueDescription
$installationarray/RequiredContains details of the installation.
Array (
[insid] => installation id
[sid] => script id
[ver] => installed version of script
[itime] => installation time
[softpath] => path to installation
[softurl] => installation URL
[softdb] => database name of installation
[softdbuser] => database user of installation
[softdbhost] => database host of installation
[softdbpass] => database password of installation )

Usage 
Uncomment the following part and add your code inside the function my_pre_clone_cli:

insert_filter('pre_clone_cli', 'my_pre_clone_cli', 1, 1);

// @param	array $installation Details of the installation imported
function my_pre_clone_cli($installation){
	global $soft, $software, $globals;
	
	// Do stuff here e.g. is as follows
	if(is_wordpress($soft)){ 
		//Do things only if its WordPress 
	}
} 

post_copy_files_clone

Description 
The post_copy_files_clone filter will triggered after the files are copied during the clone process.

Note : This filter is available since Softaculous version 6.0.2

Parameters

KeyValueDescription
$installationarray/RequiredContains details of the installation.
Array (
[insid] => installation id
[sid] => script id
[ver] => installed version of script
[itime] => installation time
[softpath] => path to installation
[softurl] => installation URL
[softdb] => database name of installation
[softdbuser] => database user of installation
[softdbhost] => database host of installation
[softdbpass] => database password of installation )

Usage 
Uncomment the following part and add your code inside the function my_post_copy_files_clone:

insert_filter('post_copy_files_clone', 'my_post_copy_files_clone', 1, 1);

// @param	array $installation Details of the installation imported
function my_post_copy_files_clone($installation){
	global $soft, $software, $globals;
	
	// Do stuff here e.g. is as follows
	if(is_wordpress($soft)){ 
		//Do things only if its WordPress 
	}
} 

post_copy_database_clone

Description 
The post_copy_database_clone filter will triggered after the database is copied during the clone process.

Note : This filter is available since Softaculous version 6.0.2

Parameters

KeyValueDescription
$installationarray/RequiredContains details of the installation.
Array (
[insid] => installation id
[sid] => script id
[ver] => installed version of script
[itime] => installation time
[softpath] => path to installation
[softurl] => installation URL
[softdb] => database name of installation
[softdbuser] => database user of installation
[softdbhost] => database host of installation
[softdbpass] => database password of installation )

Usage 
Uncomment the following part and add your code inside the function my_post_copy_database_clone:

insert_filter('post_copy_database_clone', 'my_post_copy_database_clone', 1, 1);

// @param	array $installation Details of the installation imported
function my_post_copy_database_clone($installation){
	global $soft, $software, $globals;
	
	// Do stuff here e.g. is as follows
	if(is_wordpress($soft)){ 
		//Do things only if its WordPress 
	}
} 

post_search_replace_clone

Description 
The post_search_replace_clone filter will triggered after search and replace is done during clone process.

Note : This filter is available since Softaculous version 6.0.2

Parameters

KeyValueDescription
$installationarray/RequiredContains details of the installation.
Array (
[insid] => installation id
[sid] => script id
[ver] => installed version of script
[itime] => installation time
[softpath] => path to installation
[softurl] => installation URL
[softdb] => database name of installation
[softdbuser] => database user of installation
[softdbhost] => database host of installation
[softdbpass] => database password of installation )

Usage 
Uncomment the following part and add your code inside the function my_post_search_replace_clone:

insert_filter('post_search_replace_clone', 'my_post_search_replace_clone', 1, 1);

// @param	array $installation Details of the installation imported
function my_post_search_replace_clone($installation){
	global $soft, $software, $globals;
	
	// Do stuff here e.g. is as follows
	if(is_wordpress($soft)){ 
		//Do things only if its WordPress 
	}
} 

post_clone

Description 
The post_clone filter will trigger your function after an installation is cloned.

Parameters

KeyValueDescription
$installationarray/RequiredContains details of the installation.
Array (
[insid] => installation id
[sid] => script id
[ver] => installed version of script
[itime] => installation time
[softpath] => path to installation
[softurl] => installation URL
[softdb] => database name of installation
[softdbuser] => database user of installation
[softdbhost] => database host of installation
[softdbpass] => database password of installation )

Usage 
Uncomment the following part and add your code inside the function my_post_clone:

insert_filter('post_clone', 'my_post_clone', 1, 1);
// @param   array $installation Details of the installation cloned
function my_post_clone($installation){
 global $soft, $software, $globals;
 // Do stuff here e.g. is as follows 
if($soft == 26){ 
//Do things only if its WordPress
 }
 } 

error_handle

Description 
The error_handle filter will trigger your function when an error is triggered in Softaculous and return the custom errors defined within.

Parameters

KeyValueDescription
$errorarray/RequiredContains the list of Softaculous error(s) occurred.
Array (
[ERROR_NAME] => ERROR_DESC )

Usage 
Uncomment the following part and add your code inside the function my_error_handle:

insert_filter('error_handle', 'my_error_handle', 1, 1); 
function my_error_handle($error){   
// Add your custom code here      
$error['my_cust_err'] = 'My Custom Error';     
return $error; 
} 

pre_handle_acts

Description 
The pre_handle_acts filter will trigger your function before deciding which page to be loaded The act parameter passed in the URL determines which page will be loaded. You can change the value of $act to modify which page to load in the Softaculous enduser panel.

Parameters

KeyValueDescription
$actstring/RequiredContains the page action to be loaded. E.g. software, wordpress, clone, remove, etc

Usage 
Uncomment the following part and add your code inside the function my_pre_handle_acts:

insert_filter('pre_handle_acts', 'my_pre_handle_acts', 1, 1); 
function my_pre_handle_acts($act){   
// Modify $act to change the page to be loaded
    if(empty($act)){
        // Show the WordPress Manage page as defaultpage
        $act = 'wordpress';
    }
return $act;
} 

post_load_settings

Description 
The post_load_settings filter will trigger your function after Install Form Settings are loaded and before the form is displayed in Softaculous.

Usage 
Uncomment the following part and add your code inside the function my_post_load_settings:

insert_filter('post_load_settings', 'my_post_load_settings', 1, 1); 
// @param   array $settings Contains Install Form Fields 
function my_post_load_settings($settings){ 
 // Add your custom code here
} 

pre_softaculous_upgrade

Description 
The pre_softaculous_upgrade filter will trigger your function before Softaculous Core Upgrade function is called.

Usage 
Uncomment the following part and add your code inside the function my_pre_softaculous_upgrade:

insert_filter('pre_softaculous_upgrade', 'my_pre_softaculous_upgrade', 1);
function my_pre_softaculous_upgrade(){ 
// Add your custom code here 
} 

post_softaculous_upgrade

Description 
The post_softaculous_upgrade filter will trigger your function after Softaculous Core Upgrade function is called.

Usage 
Uncomment the following part and add your code inside the function my_post_softaculous_upgrade:

insert_filter('post_softaculous_upgrade', 'my_post_softaculous_upgrade', 1); 
function my_post_softaculous_upgrade(){ 
// Add your custom code here 
} 

post_unzip

Description 
The post_unzip filter will trigger your function after the script package is unzipped when installing the script or upgrading, cloning, etc.

Usage 
Uncomment the following part and add your code inside the function my_post_unzip:

insert_filter('post_unzip', 'my_post_unzip', 1); 
function my_post_unzip(){ 
// Add your custom code here 
} 

pre_unzip

Description

The pre_unzip filter will trigger your function before the script package is unzipped when installing the script or upgrading, cloning, etc. The zip file will be only be extracted if the function returns “true”.

Note : This filter is available since Softaculous version 5.7.3

Parameters

KeyValueDescription
$doBoolean/requiredIf the zip file should be extracted or not. Set to “true” by default.
$zipfileString/requiredThe path to the zip file. For example: ‘/var/softaculous/wp/wp.zip’
$destinationString/requiredThe path to where the zip file should be extracted. For example: ‘/home/USER/public_html/wp’

Usage 
Uncomment the following part and add your code inside the function my_pre_unzip:

insert_filter('pre_unzip', 'my_pre_unzip', 1, 3);

// Default value for $do is true
function my_pre_unzip($do, $zipfile, $destination_path){
    
    global $soft, $software, $scripts;
    
    // Are we installing WordPress ? 
    if(!empty($soft) && $soft == 26){
        // Ask Softaculous not to unzip the files
        $do = false;
    }
    
    return $do;
    
}

post_top_scripts_interface

Description 
This filter allows you to add custom content after Top Scripts is rendered in Enduser Panel.

Note : This filter is available since Softaculous version 5.5.6

insert_filter('post_top_scripts_interface', 'my_post_top_scripts_interface', 1);
function my_post_top_scripts_interface(){ 
// Add your custom code here 
} 

navbar_links

Description 
The navbar_links filter will trigger your function before displaying the links in Navbar in Softaculous Enduser Panel (top right hand corner). Use this filter to Add/Remove the navbar links.

Parameters

KeyValueDescription
$navbararray/RequiredContains details of the installation.
Array (

[‘goto_control_panel’] => Array(
[‘fullscreen’] => HTML content for the link
[‘responsive’] => HTML content for the link )

[‘add_domain’] => Array(
[‘fullscreen’] => HTML content for the link
[‘responsive’] => HTML content for the link )

[‘goto_demo’] => Array(
[‘fullscreen’] => HTML content for the link
[‘responsive’] => HTML content for the link )

[‘goto_rating’] => Array(
[‘fullscreen’] => HTML content for the link
[‘responsive’] => HTML content for the link )

[‘goto_installations’] => Array(
[‘fullscreen’] => HTML content for the link
[‘responsive’] => HTML content for the link )

[‘goto_tasklist’] => Array(
[‘fullscreen’] => HTML content for the link
[‘responsive’] => HTML content for the link )

[‘goto_settings’] => Array(
[‘fullscreen’] => HTML content for the link
[‘responsive’] => HTML content for the link )

[‘goto_backups’] => Array(
[‘fullscreen’] => HTML content for the link
[‘responsive’] => HTML content for the link )

[‘goto_email_settings’] => Array(
[‘fullscreen’] => HTML content for the link
[‘responsive’] => HTML content for the link )

[‘goto_premium_themes’] => Array(
[‘fullscreen’] => HTML content for the link
[‘responsive’] => HTML content for the link )

[‘goto_sync’] => Array( [‘fullscreen’] => HTML content for the link
[‘responsive’] => HTML content for the link )

[‘goto_help’] => Array( [‘fullscreen’] => HTML content for the link [‘responsive’] => HTML content for the link )

[‘goto_logout’] => Array(
[‘fullscreen’] => HTML content for the link [‘responsive’] => HTML content for the link )
)

Usage 
Uncomment the following part and add your code inside the function my_navbar_links:

insert_filter('navbar_links', 'my_navbar_links', 1, 1); 
// @param   array $navbar contains the navbar links 
function my_navbar_links($navbar){ 
// Add your custom code here 

unset($navbar['goto_email_settings']); // Example to disable email settings link 
unset($navbar['goto_backups']); // Example to disable backups link 
return $navbar; 
} 

eu_php_bin

Description 
The eu_php_bin filter is used to define a php binary path if you are using custom PHP binary and want to define the same in Softaculous.

Parameters

KeyValueDescription
$php_binstring/RequiredContains path of the php binary.

Usage 
Uncomment the following part and add your code inside the function my_eu_php_bin:

insert_filter('eu_php_bin', 'my_eu_php_bin', 1, 1); 
// @param string $php_bin Path of php binary 
function my_eu_php_bin($php_bin){ 
// Add your custom code here 
$php_bin = '/PATH/TO/PHPBIN'; 
return $php_bin; 
} 

post_load_dbdetails

Description 
The post_load_dbdetails filter is used to set database details to be pre-filled on install form.

Parameters

KeyValueDescription
$dbdetailsarray/RequiredContains prefilled DB details for the installation.
Array (
[‘dbname’] => db_name,
[‘dbusername’] => db_username,
[‘dbuserpass’] => db_userpass,
[‘dbhost’] => db_host )

Usage 
Uncomment the following part and add your code inside the function my_post_load_dbdetails:

insert_filter('post_load_dbdetails', 'my_post_load_dbdetails', 1, 1); 
// @param  array $dbdetails Prefilled DB details for the installation 
function my_post_load_dbdetails($dbdetails){
// Add your custom code here 
$dbdetails['dbname'] = '';
$dbdetails['dbusername'] = ''; // This can be used only in Softaculous Remote 
$dbdetails['dbuserpass'] = ''; // This can be used only in Softaculous Remote 
$dbdetails['dbhost'] = ''; // This can be used only in Softaculous Remote 
return $dbdetails; 
} 

pre_update_email

Description 

  • The pre_update_email filter will trigger your function whenever an UPDATE becomes available for an installation AND before an email is sent to the user informing him about the update.
  • The main usage of this filter is if you want to send out a CUSTOM Email when a script update is available. e.g. if a new version of WordPress is available, Softaculous will load all the list of users who have WordPress installations and will email them of the same. But if you want to send them an email yourself, you can use this filter.

Usage 
Uncomment the following part and add your code inside the function my_pre_update_email:

insert_filter('pre_update_email', 'my_pre_update_email', 1); 
function my_pre_update_email(){ 
global $globals, $ins_list, $updated_scripts, $scripts; 
// $ins_list    - Will contain the details of the OUTDATED installations of all users immediately when an update becomes available 
// $updated_scripts  - The scripts which just got updated 
// $scripts  - Detailed information about all the scripts. foreach($ins_list as $username => $scriptwise){ 
// Do what needs to be done ! 
// $scriptwise will now contain the list of installations in the format of array(SCRIPTID => array()); 
foreach($scriptwise as $_sid => $_ins){ 
// Loop through the installations 
foreach($_ins as $kk => $vv){ 
    } 
   } 
 } 
} 

post_adddomain

Description 
The post_adddomain filter will trigger your function after a Domain is added.
Note : This filter is only available in Softaculous Remote.

Parameters

KeyValueDescription
$didstring/RequiredDomain ID of the domain added.

Usage 
Uncomment the following part and add your code inside the function my_post_adddomain:

insert_filter('post_adddomain', 'my_post_adddomain', 1, 1); 
// @param   string $did Domain ID of the domain added 
function my_post_adddomain($did){ 
global $softpanel, $globals; 
// Do stuff here 
// e.g. is for if you want to perform action only for apache 
} 

post_editdomain

Description 
This filter will trigger your function after a Domain is edited.

Note : This filter is only available in Softaculous Remote.

Parameters

KeyValueDescription
$didstring/RequiredDomain ID of the domain edited.

Usage 
Uncomment the following part and add your code inside the function my_post_editdomain:

insert_filter('post_editdomain', 'my_post_editdomain', 1, 1); 
// @param   string $did Domain ID of the domain edited 
function my_post_editdomain($did){ 
global $softpanel, $globals; 
// Do stuff here 
// e.g. is for if you want to perform action only for apache 
} 

remote_exec_url

Description 
This filter can be used if you want to use custom URLs for Softaculous Remote calls to perform tasks such as install, etc.

Note : This filter is available since Softaculous version 4.8.0 and is only available on Softaculous Remote.

Parameters

KeyValueDescription
$urlstring/RequiredCustom URL

Usage 
Uncomment the following part and add your code inside the function my_remote_exec_url:

insert_filter('remote_exec_url', 'my_remote_exec_url', 1, 1); 
// @param   array $url URL where the script is to be installed 
function my_remote_exec_url($url){ 
// Add your custom code here 
//echo $url; //E.g. http://example.com/sreq.php 
$parse = parse_url($url); 
$custom_url = 'domain.com'; //This url should point to the location where the current domain being installed is pointing 
$url = str_replace($parse['host'], $custom_url, $url); 
//echo $url; //E.g. http://domain.com/sreq.php 
return $url; 
} 

post_load_soft

Description 
This filter can be used to modify the id of the script to be installed.

Note : This filter is available since Softaculous version 4.8.0.

Parameters

KeyValueDescription
$softint/RequiredScript ID to be installed.

Usage 
Uncomment the following part and add your code inside the function my_post_load_soft:

insert_filter('post_load_soft', 'my_post_load_soft', 1, 1); 
// @param  array $soft Contains softid 
function my_post_load_soft($soft){
 // Add your custom code here 
return $soft; 
} 

pre_addcron

Description 
The pre_addcron filter will trigger your function right before the cron job is added for an installation while installing the script. You can make changes to the cron execution time as well as the cron command.

Note : This filter is available since Softaculous version 4.8.9.

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_pre_addcron:

insert_filter('pre_addcron', 'my_pre_addcron', 1, 1); 
function my_pre_addcron($cron){
 global $soft, $software, $globals; 
//Add your custom cron command in $cron array. 
$cron['cron_min'] = ''; 
$cron['cron_hour'] = '';  
$cron['cron_day'] = ''; 
$cron['cron_month'] = ''; 
$cron['cron_weekday'] = ''; 
$cron['cron_command'] = ''; 
return $cron; 
} 

post_addcron

Description 
The post_addcron filter will trigger your function right after the cron job is added during an installation.

Note : This filter is available since Softaculous version 4.8.9.

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_post_addcron:

insert_filter('post_addcron', 'my_post_addcron', 1, 1); 
function my_post_addcron($cron){ 
global $soft, $software, $globals; 
//Add your custom code here. 
} 

pre_backup

Description 
The pre_backup filter will trigger your function right before the backup started.

Note : This filter is available since Softaculous version 5.1.2.

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_pre_backup:

insert_filter('pre_backup', 'my_pre_backup', 1, 1); 
function my_pre_backup($data){ 
//Add your custom code here. 
} 

post_backup

Description 
The post_backup filter will trigger your function right after the backup finished.

Note : This filter is available since Softaculous version 5.1.2.

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_post_backup:

insert_filter('post_backup', 'my_post_backup', 1, 1);
function my_post_backup($data){
 //Add your custom code here. 
} 

soft_php_bin

Description 
Use this filter to pass the path to PHP binary which should be used to perform operations like Clone, Remote Import, etc.

Note : This filter is available since Softaculous version 4.9.2.

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_soft_php_bin:

insert_filter('soft_php_bin', 'my_soft_php_bin', 1, 1); 
function my_soft_php_bin($phpbin){ 
// Note : The PHP binary should be a CLI PHP binary 
$phpbin = '/PATH/TO/PHPBIN'; //Define your php binary here 
return $phpbin; 
} 

pre_softaculous_upgrade_check

Description 
The pre_softaculous_upgrade_check filter will trigger your function before the Softaculous Core Upgrade check is performed.

Note : This filter is available since Softaculous version 4.9.0 

Note : This filter is for Softaculous core upgrade and not script updates.

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_pre_softaculous_upgrade_check:

insert_filter('pre_softaculous_upgrade_check',  'my_pre_softaculous_upgrade_check', 1); 
function my_pre_softaculous_upgrade_check(){ 
// Add your custom code here 
} 

upgrade_softaculous_to_version

Description 
The upgrade_softaculous_to_version filter will trigger your function and define the version of Softaculous you want to upgrade to. Make sure you pass correct version of Softaculous you want to upgrade to, otherwise you will be upgraded to the latest version.

  • If you enter the version as less than the Softaculous version you are currently at, Softaculous will be upgraded to the latest version.
  • If you pass the version greater than or equal to the Softaculous version you are currently at but less than or equal to the latest Softaculous version, Softaculous will be upgraded to that particular version. But if the passed version is greater than the latest Softaculous version, your Softaculous will be upgraded to the latest version only.

Note : This filter is available since Softaculous version 4.9.0.

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_upgrade_softaculous_to_version:

insert_filter('upgrade_softaculous_to_version', 'my_upgrade_softaculous_to_version', 1); 
function my_upgrade_softaculous_to_version(){ 
return '4.9.0'; // this example will upgrade Softaculous to 4.9.0 
} 

check_files_exist

Description 
The check_files_exist filter will trigger your function when Softaculous checks for files already exists while installing a script, use this filter to add or remove the list of files existing in the path where you are installing a script. The list returned after applying this filter is the list for which the user will be reported of files already exists (with an option to overwrite the files).

Note : This filter is available since Softaculous version 4.9.0

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_check_files_exist:

insert_filter('check_files_exist', 'my_check_files_exist', 1, 1); 
function my_check_files_exist($exists){ 
//e.g if you want to unset .htaccess  
if(in_array('.htaccess', $exists)){ 
  $htaccess_key = array_search('.htaccess', $exists);
  unset($exists[$htaccess_key]); 
} 
return $exists; 
} 

post_loadinstallations

Description 
The post_loadinstallations filter will trigger your function before loading installations of a user in Softaculous. You will get a list of all your installations here so that you can modify the details as per your requirement and return the list back.

Note : This filter is available since Softaculous version 4.9.3

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_post_loadinstallations:

insert_filter('post_loadinstallations', 'my_post_loadinstallations', 1, 1); 
// @param   array $data List of installations 
function my_post_loadinstallations($data){ 
r_print($data);         
//Write your code here         
//Use this if you want to save the changes you made to the installation details 
saveinstallations($data); 
return $data; 
} 

post_listinstallations

Description 
The post_listinstallations filter will trigger your function before listing installations of all the users in Softaculous Admin. You will get a list of all your installations of all the users here so that you can modify the details as per your requirement and return the list back.

Note : This filter is available since Softaculous version 4.9.3

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_post_listinstallations:

insert_filter('post_listinstallations', 'my_post_listinstallations', 1, 1); 
// @param  array $data List of installations 
function my_post_listinstallations($data){ 
r_print($data);
//Write your code here
//Use this if you want to save the changes you made to the installation details
saveinstallations($data); 
return $data;
} 

pre_upgrade_outdated_plugins

Description 
The pre_upgrade_outdated_plugins filter will trigger your function before upgrading the outdated plugins. You will get a list of all the outdated plugins so that you can make the changes to the list as per your need and return the list back.

Note : This filter is available since Softaculous version 4.9.3

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_pre_upgrade_outdated_plugins:

insert_filter('pre_upgrade_outdated_plugins', 'my_pre_upgrade_outdated_plugins', 1, 1); 
// @param   array $plugins List of outdated plugins 
function my_pre_upgrade_outdated_plugins($plugins){ 
//Filter the list as per your need 
//Example of the plugins list you will get here
r_print($plugins); // This will print the list of outdated plugins
return $plugins; 
} 

pre_upgrade_outdated_theme

Description 
The pre_upgrade_outdated_theme filter will trigger your function before upgrading the active outdated theme. You will get the data of your active outdated theme so that you can make the changes to the data as per your need and return it back.

Note : This filter is available since Softaculous version 4.9.3

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_pre_upgrade_outdated_theme:

insert_filter('pre_upgrade_outdated_theme','my_pre_upgrade_outdated_theme', 1, 1); 
// @param  object $theme_data Theme's data 
function my_pre_upgrade_outdated_theme($theme_data){ 
//Make changes as per your need 
//Example of the theme's api data you will get here
r_print($theme_data); // This will print the list of outdated themes
return $theme_data; 
} 

dns_server_ip

Description 
The dns_server_ip filter will trigger your function and will make the domain point to the IP defined in the filter in case the DNS has not propogated yet and the domain is still pointing the old server.

Note : This filter is available since Softaculous version 4.9.3

Usage 
Uncomment the following part inside filter.php and define the IP where you want your domain to point to in the code inside the function my_dns_server_ip:

insert_filter('dns_server_ip', 'my_dns_server_ip', 1, 1); 
// @param  string $domain The Domain to which the call will be made
function my_dns_server_ip($domain){
 $ip = '1.2.3.4'; //Define the IP where your domain should point 
return $ip; 
} 

pre_createdb

Description  The pre_createdb filter will trigger your function beforethe database is created by Softaculous during script install.

Note : This filter is available since Softaculous version 5.3.7

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_pre_createdb:

insert_filter('pre_createdb', 'my_pre_createdb', 1);  
function my_pre_createdb(){  
global $__settings;  
// Execute your code here  
echo  $__settings['softdb']; // This will echo the  Database Name
echo  $__settings['softdbhost']; // This will echo the  Database  Host  
echo  $__settings['softdbuser']; // This will echo the  Database  User  
echo  $__settings['softdbpass']; // This will echo the  Database  Pass  
echo  $__settings['dbprefix']; // This will echo the  Table Prefix
}  

post_createdb

Description 
The post_createdb filter will trigger your function after the database is created by Softaculous during script install.

Note : This filter is available since Softaculous version 5.0.0

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_post_createdb:

insert_filter('post_createdb', 'my_post_createdb', 1); 
function my_post_createdb(){ 
global $__settings; 
// Execute your code here 
echo  $__settings['softdb']; // This will echo the  Database Name
echo  $__settings['softdbhost']; // This will echo the  Database  Host  
echo  $__settings['softdbuser']; // This will echo the  Database  User  
echo  $__settings['softdbpass']; // This will echo the  Database  Pass  
echo  $__settings['dbprefix']; // This will echo the  Table Prefix 
} 

domains_list

Description 
The domains_list filter will trigger your function after the domains list is propagated by Softaculous. This filter allows you to add/remove domains from the domains list generated by Softaculous. 

Note : This filter is available since Softaculous version 5.0.0

Usage 
Uncomment the following part inside filter.php and define the IP where you want your domain to point to in the code inside the function my_domains_list:

insert_filter('domains_list', 'my_domains_list', 1, 1); 
// @param   string $domains Domains list with domain name in the key and path to the domain in value 
function my_domains_list($domains){ 
// example to remove a domain name from the domains list 
unset($domains['example.com']); 

// example to add a domain name 
// Note : In case of Softaculous Remote and Enterprise, the domain you are adding here should be added in the panel 
$domains['example.com'] = '/home/example/public_html'; 

// Return the list of domains 
return $domains; 
} 

pre_staging

Description 
The pre_staging filter will trigger your function before the Staging process is started. 

Note : This filter is available since Softaculous version 5.0.5

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_pre_staging:

insert_filter('pre_staging', 'my_pre_staging', 1, 1); 
function my_pre_staging(){ 
global $soft, $software, $globals;
 // Do stuff here e.g. is as follows 
if($soft == 26){
 //Do things only if its WordPress 
} 
} 

pre_staging_cli

Description 
The pre_staging filter will triggered before the CLI staging process starts. 

Note : This filter is available since Softaculous version 6.0.2

Parameters

KeyValueDescription
$installationarray/RequiredContains details of the installation.
Array (
[insid] => installation id
[sid] => script id
[ver] => installed version of script
[itime] => installation time
[softpath] => path to installation
[softurl] => installation URL
[softdb] => database name of installation
[softdbuser] => database user of installation
[softdbhost] => database host of installation
[softdbpass] => database password of installation )

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_pre_staging_cli:

insert_filter('pre_staging_cli', 'my_pre_staging_cli', 1, 1);

// @param	array $installation Details of the installation imported
function my_pre_staging_cli($installation){
	global $soft, $software, $globals;
	
	// Do stuff here e.g. is as follows
	if(is_wordpress($soft)){ 
		//Do things only if its WordPress 
	}
} 

post_copy_files_staging

Description 
The post_copy_files_staging filter will triggered after the files are copied during staging process. 

Note : This filter is available since Softaculous version 6.0.2

Parameters

KeyValueDescription
$installationarray/RequiredContains details of the installation.
Array (
[insid] => installation id
[sid] => script id
[ver] => installed version of script
[itime] => installation time
[softpath] => path to installation
[softurl] => installation URL
[softdb] => database name of installation
[softdbuser] => database user of installation
[softdbhost] => database host of installation
[softdbpass] => database password of installation )

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_post_copy_files_staging:

insert_filter('post_copy_files_staging', 'my_post_copy_files_staging', 1, 1);

// @param	array $installation Details of the installation imported
function my_post_copy_files_staging($installation){
	global $soft, $software, $globals;
	
	// Do stuff here e.g. is as follows
	if(is_wordpress($soft)){ 
		//Do things only if its WordPress 
	}
}

post_copy_database_staging

Description 
The post_copy_database_staging filter will triggered after the database is copied during staging process. 

Note : This filter is available since Softaculous version 6.0.2

Parameters

KeyValueDescription
$installationarray/RequiredContains details of the installation.
Array (
[insid] => installation id
[sid] => script id
[ver] => installed version of script
[itime] => installation time
[softpath] => path to installation
[softurl] => installation URL
[softdb] => database name of installation
[softdbuser] => database user of installation
[softdbhost] => database host of installation
[softdbpass] => database password of installation )

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_post_copy_database_staging:

insert_filter('post_copy_database_staging', 'my_post_copy_database_staging', 1, 1);

// @param	array $installation Details of the installation imported
function my_post_copy_database_staging($installation){
	global $soft, $software, $globals;
	
	// Do stuff here e.g. is as follows
	if(is_wordpress($soft)){ 
		//Do things only if its WordPress 
	}
}

post_search_replace_staging

Description 
The post_search_replace_staging filter will triggered after search and replace is done during staging process. 

Note : This filter is available since Softaculous version 6.0.2

Parameters

KeyValueDescription
$installationarray/RequiredContains details of the installation.
Array (
[insid] => installation id
[sid] => script id
[ver] => installed version of script
[itime] => installation time
[softpath] => path to installation
[softurl] => installation URL
[softdb] => database name of installation
[softdbuser] => database user of installation
[softdbhost] => database host of installation
[softdbpass] => database password of installation )

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_post_search_replace_staging:

insert_filter('post_search_replace_staging', 'my_post_search_replace_staging', 1, 1);

// @param	array $installation Details of the installation imported
function my_post_search_replace_staging($installation){
	global $soft, $software, $globals;
	
	// Do stuff here e.g. is as follows
	if(is_wordpress($soft)){ 
		//Do things only if its WordPress 
	}
}

post_staging

Description 
The post_staging filter will trigger your function after the staging copy of an installation is created.

Parameters

KeyValueDescription
$installationarray/RequiredContains details of the staging installation created.
Array (
[insid] => installation id
[sid] => script id
[ver] => installed version of script
[itime] => installation time
[softpath] => path to installation
[softurl] => installation URL
[softdb] => database name of installation
[softdbuser] => database user of installation
[softdbhost] => database host of installation
[softdbpass] => database password of installation )

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_post_staging:

insert_filter('post_staging', 'my_post_staging', 1, 1); 
// @param  array $installation Details of the staging installation created 
function my_post_staging($installation){
 global $soft, $software, $globals;
 // Do stuff here e.g. is as follows 
if($soft == 26){  
//Do things only if its WordPress 
 } 
} 

pre_pushtolive

Description 
The pre_pushtolive filter will trigger your function before a staging installation is pushed to live. 

Note : This filter is available since Softaculous version 5.0.5

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_pre_pushtolive:

insert_filter('pre_pushtolive', 'my_pre_pushtolive', 1, 1);
 function my_pre_pushtolive(){
 global $soft, $software, $globals;
 // Do stuff here e.g. is as follows 
if($soft == 26){
 //Do things only if its WordPress
 }
 } 

pre_pushtolive_cli

Description 
The pre_pushtolive_cli filter will triggered before the CLI push to live process starts. 

Note : This filter is available since Softaculous version 6.0.2

Parameters

KeyValueDescription
$installationarray/RequiredContains details of the staging installation created.
Array (
[insid] => installation id
[sid] => script id
[ver] => installed version of script
[itime] => installation time
[softpath] => path to installation
[softurl] => installation URL
[softdb] => database name of installation
[softdbuser] => database user of installation
[softdbhost] => database host of installation
[softdbpass] => database password of installation )

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_pre_pushtolive_cli:

insert_filter('pre_pushtolive_cli', 'my_pre_pushtolive_cli', 1, 1);

// @param	array $installation Details of the installation imported
function my_pre_pushtolive_cli($installation){
	global $soft, $software, $globals;
	
	// Do stuff here e.g. is as follows
	if(is_wordpress($soft)){ 
		//Do things only if its WordPress 
	}
}

pre_backup_pushtolive

Description 
The pre_backup_pushtolive filter will triggered before push to live backup process starts. 

Note : This filter is available since Softaculous version 6.0.2

Parameters

KeyValueDescription
$installationarray/RequiredContains details of the staging installation created.
Array (
[insid] => installation id
[sid] => script id
[ver] => installed version of script
[itime] => installation time
[softpath] => path to installation
[softurl] => installation URL
[softdb] => database name of installation
[softdbuser] => database user of installation
[softdbhost] => database host of installation
[softdbpass] => database password of installation )

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_pre_backup_pushtolive:

insert_filter('pre_backup_pushtolive', 'my_pre_backup_pushtolive', 1, 1);

// @param	array $installation Details of the installation imported
function my_pre_backup_pushtolive($installation){
	global $soft, $software, $globals;
	
	// Do stuff here e.g. is as follows
	if(is_wordpress($soft)){ 
		//Do things only if its WordPress 
	}
}

post_backup_pushtolive

Description 
The post_backup_pushtolive filter will triggered after push to live backup process is completed. 

Note : This filter is available since Softaculous version 6.0.2

Parameters

KeyValueDescription
$installationarray/RequiredContains details of the staging installation created.
Array (
[insid] => installation id
[sid] => script id
[ver] => installed version of script
[itime] => installation time
[softpath] => path to installation
[softurl] => installation URL
[softdb] => database name of installation
[softdbuser] => database user of installation
[softdbhost] => database host of installation
[softdbpass] => database password of installation )

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_post_backup_pushtolive:

insert_filter('post_backup_pushtolive', 'my_post_backup_pushtolive', 1, 1);

// @param	array $installation Details of the installation imported
function my_post_backup_pushtolive($installation){
	global $soft, $software, $globals;
	
	// Do stuff here e.g. is as follows
	if(is_wordpress($soft)){ 
		//Do things only if its WordPress 
	}
}

post_copy_files_pushtolive

Description 
The post_copy_files_pushtolive filter will triggered after the files are copied during push to live process. 

Note : This filter is available since Softaculous version 6.0.2

Parameters

KeyValueDescription
$installationarray/RequiredContains details of the staging installation created.
Array (
[insid] => installation id
[sid] => script id
[ver] => installed version of script
[itime] => installation time
[softpath] => path to installation
[softurl] => installation URL
[softdb] => database name of installation
[softdbuser] => database user of installation
[softdbhost] => database host of installation
[softdbpass] => database password of installation )

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_post_copy_files_pushtolive:

insert_filter('post_copy_files_pushtolive', 'my_post_copy_files_pushtolive', 1, 1);

// @param	array $installation Details of the installation imported
function my_post_copy_files_pushtolive($installation){
	global $soft, $software, $globals;
	
	// Do stuff here e.g. is as follows
	if(is_wordpress($soft)){ 
		//Do things only if its WordPress 
	}
}

post_copy_database_pushtolive

Description 
The post_copy_database_pushtolive filter will triggered after the database is copied during push to live process. 

Note : This filter is available since Softaculous version 6.0.2

Parameters

KeyValueDescription
$installationarray/RequiredContains details of the staging installation created.
Array (
[insid] => installation id
[sid] => script id
[ver] => installed version of script
[itime] => installation time
[softpath] => path to installation
[softurl] => installation URL
[softdb] => database name of installation
[softdbuser] => database user of installation
[softdbhost] => database host of installation
[softdbpass] => database password of installation )

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_post_copy_database_pushtolive:

insert_filter('post_copy_database_pushtolive', 'my_post_copy_database_pushtolive', 1, 1);

// @param	array $installation Details of the installation imported
function my_post_copy_database_pushtolive($installation){
	global $soft, $software, $globals;
	
	// Do stuff here e.g. is as follows
	if(is_wordpress($soft)){ 
		//Do things only if its WordPress 
	}
}

post_search_replace_pushtolive

Description 
The post_search_replace_pushtolive filter will trigger your function after search and replace is done during push to live process.

Parameters

KeyValueDescription
$installationarray/RequiredContains details of the live installation into which the staging environment is pushed.
Array (
[insid] => installation id
[sid] => script id
[ver] => installed version of script
[itime] => installation time
[softpath] => path to installation
[softurl] => installation URL
[softdb] => database name of installation
[softdbuser] => database user of installation
[softdbhost] => database host of installation
[softdbpass] => database password of installation )

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_post_search_replace_pushtolive:

insert_filter('post_search_replace_pushtolive', 'my_post_search_replace_pushtolive', 1, 1);

// @param	array $installation Details of the installation imported
function my_post_search_replace_pushtolive($installation){
	global $soft, $software, $globals;
	
	// Do stuff here e.g. is as follows
	if(is_wordpress($soft)){ 
		//Do things only if its WordPress 
	}
}

post_pushtolive

Description 
The post_pushtolive filter will trigger your function after a staging installation is pushed to live.

Parameters

KeyValueDescription
$installationarray/RequiredContains details of the live installation into which the staging environment is pushed.
Array (
[insid] => installation id
[sid] => script id
[ver] => installed version of script
[itime] => installation time
[softpath] => path to installation
[softurl] => installation URL
[softdb] => database name of installation
[softdbuser] => database user of installation
[softdbhost] => database host of installation
[softdbpass] => database password of installation )

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_post_pushtolive:

insert_filter('post_pushtolive', 'my_post_pushtolive', 1, 1); 
// @param   array $installation Details of the live installation into which the staging environment is pushed 
function my_post_pushtolive($installation){
global $soft, $software, $globals; 
// Do stuff here e.g. is as follows 
if($soft == 26){
 //Do things only if its WordPress  
}
} 

pre_edit_installation

Description 
The pre_edit_installation filter will trigger your function before the details of an installation are edited.

Note : This filter is available since Softaculous version 5.6.4

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_pre_edit_installation:

insert_filter('pre_edit_installation', 'my_pre_edit_installation', 1);
 function my_pre_edit_installation(){
     global $soft, $software, $globals;
     // Do stuff here e.g. is as follows 
     if($soft == 26){      
          //Do things only if its WordPress  
     }
 }

post_edit_installation

Description 
The post_edit_installation filter will trigger your function after the details of an installation are edited.

Note : This filter is available since Softaculous version 5.6.4

Parameters

KeyValueDescription
$installationarrayContains details of the installation which is being edited.
Array (
[insid] => installation id
[sid] => script id
[ver] => installed version of script
[itime] => installation time
[softpath] => path to installation
[softurl] => installation URL
[softdb] => database name of installation
[softdbuser] => database user of installation
[softdbhost] => database host of installation
[softdbpass] => database password of installation )

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_post_edit_installation:

insert_filter('post_edit_installation', 'my_post_edit_installation', 1, 1);
 // @param    array $installation Details of the installation being edited
 function my_post_edit_installation($installation){
     global $soft, $software, $globals;
     // Do stuff here e.g. is as follows 
     if($soft == 26){      
          //Do things only if its WordPress  
     }
 }

pre_addcron_auto_backup

Description 
The pre_addcron_auto_backup filter will trigger your function right before the cron job for auto backup is added for an installation while installing/editing the script. You can make changes to the cron execution time as well as the cron command.

Note : This filter is available since Softaculous version 5.0.5

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_pre_addcron_auto_backup:

insert_filter('pre_addcron_auto_backup', 'my_pre_addcron_auto_backup', 1, 1); 
function my_pre_addcron_auto_backup($cron){ 
global $soft, $software, $globals; 
//Add your custom cron command in $cron array. 
$cron['cron_min'] = ''; 
$cron['cron_hour'] = '';  
$cron['cron_day'] = '';
$cron['cron_month'] = ''; 
$cron['cron_weekday'] = '';
$cron['cron_command'] = ''; 
return $cron;
} 

post_addcron_auto_backup

Description 
The post_addcron_auto_backup filter will trigger your function right after the cron job for auto backup is added for an installation while installing/editing the script.

Note : This filter is available since Softaculous version 5.0.5

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_post_addcron_auto_backup:

insert_filter('post_addcron_auto_backup', 'my_post_addcron_auto_backup', 1, 1); 
function my_post_addcron_auto_backup($cron){
 global $soft, $software, $globals; 
//Add your custom code here.
 } 

faqs

Description 
The faqs filter will trigger your function before displaying the FAQs in the enduser panel. You can edit existing FAQs, remove existing FAQs or add new FAQs.

Note : This filter is available since Softaculous version 5.2.8

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_faqs:

insert_filter('faqs', 'my_faqs', 1, 1); 
function my_faqs($faqs){
// Add a FAQ 
$faqs['custom_faq_1']['question'] = 'Customized Question';
$faqs['custom_faq_1']['answer'] = 'Customized Answer'; 
// Unset an existing FAQ 
unset($faqs['softaculous_intro']); 
return $faqs;
 } 

check_softpath_exist

Description 
The check_softpath_exist filter will trigger when a user is installing a script in a sub-directory. Softaculous will check if the directory already exists and pass on to this filter. If you want to make a custom check or overwrite the check done by Softaculous you can use this filter.

Note : This filter is available since Softaculous version 5.3.3

Usage 
Uncomment the following part inside filter.php and add your code inside the function check_softpath_exist:

insert_filter('check_softpath_exist', 'my_check_softpath_exist', 1, 1); 
function my_check_softpath_exist($softpath_exist, $softpath){
//Return false to allow Softaculous to continue installation OR true to stop installation. 
return false;
 }

auto_upgrade_installation_accessible

Description 
The auto_upgrade_installation_accessible filter can be used to force upgrade even if the installation is not accessible via curl OR can be used if the user do not want to allow auto upgrade.
Softaculous will skip the curl call check for the installation during upgrade if return true and Softaculous will not allow auto upgrade if return false.

Note : This filter is available since Softaculous version 5.4.1

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_auto_upgrade_installation_accessible

insert_filter('auto_upgrade_installation_accessible', 'my_auto_upgrade_installation_accessible', 1, 1); 
function my_auto_upgrade_installation_accessible($is_accessible){
  // Return true if you want to force upgrade even if the installation is not accessible via curl 
  return true;

  // Return false if you do not want to allow auto upgrade
  return false;
}

pre_filelist

Description 
The pre_filelist filter can be used to return the files/folders list in a specific directory.
Softaculous will skip its process of listing and will use the array returned by this filter.

Note : This filter is available since Softaculous version 5.3.4

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_pre_filelist

insert_filter('pre_filelist', 'my_pre_filelist', 1, 3);
function my_pre_filelist($filelist, $scandir, $options){  
// Return the filelist array
     return $filelist; 
}

Parameters
$filelist : (array) This will always be empty in pre_filelist filter
$scandir : (string) This is the directory for which you need to return the files/folders
$options : (array) This contains the constrains you need to use while calculating the list
Structure of $options parameter :

$options = array('sub_directories' => $searchSubdirs, // 1 - to search in sub directories
            'directories_only' => $directoriesonly, // 1 - to look for directories only OR 0 - for files and dirs
            'maximum_level' => $maxlevel, // Maximum number of recursions for sub dirs | 'all' refers to no limit
            'start_level' => $level); // The sub-directory level to start with

Sample structure of the $filelist array you need to return

File in the 1st level
[/var/www/html/file.txt] => Array
(
[level] => 1
[dir] => 0
[name] => file.txt
[path] => /var/www/html/
)

Directory in the 1st level
[/var/www/html/dir] => Array
(
[level] => 1
[dir] => 1
[name] => dir
[path] => /var/www/html/
)

File in the 2nd level
[/var/www/html/dir/new.php] => Array
(
[level] => 2
[dir] => 0
[name] => new.php
[path] => /var/www/html/dir/
)

post_filelist

Description 
The post_filelist filter can be used to modify the files/folders list in a specific directory calculated by Softaculous.

Note : This filter is available since Softaculous version 5.3.4

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_post_filelist

insert_filter('post_filelist', 'my_post_filelist', 1, 3);
function my_post_filelist($filelist, $scandir, $options){  
// Return the filelist array
     return $filelist; 
}

Parameters
$filelist : (array) This will be the list calculated by Softaculous. You can make changes in this array and return the new array
$scandir : (string) This is the directory for which you need to return the files/folders
$options : (array) This contains the constrains you need to use while calculating the list
Structure of $options parameter :

$options = array('sub_directories' => $searchSubdirs, // 1 - to search in sub directories
            'directories_only' => $directoriesonly, // 1 - to look for directories only OR 0 - for files and dirs
            'maximum_level' => $maxlevel, // Maximum number of recursions for sub dirs | 'all' refers to no limit
            'start_level' => $level); // The sub-directory level to start with

Sample structure of the $filelist array you need to return

File in the 1st level
[/var/www/html/file.txt] => Array
(
[level] => 1
[dir] => 0
[name] => file.txt
[path] => /var/www/html/
)

Directory in the 1st level
[/var/www/html/dir] => Array
(
[level] => 1
[dir] => 1
[name] => dir
[path] => /var/www/html/
)

File in the 2nd level
[/var/www/html/dir/new.php] => Array
(
[level] => 2
[dir] => 0
[name] => new.php
[path] => /var/www/html/dir/
)

pre_import_save

Description 
This filter allows you to modify the installation details before it is saved while importing the installation (by enduser).

Note : This filter is available since Softaculous version 5.3.4
Note : This filter is executed only when installations are imported by Endusers

Usage 
Uncomment the following part inside filter.php and add your code inside the function pre_import_save:

insert_filter('pre_import_save', 'my_pre_import_save', 1, 1);
 function my_pre_import_save($ins){
// If you would like to save a WordPress installation into your custom WordPress package you can update SID 
$ins['sid'] = 10001; // This will save the SID of the installation to 10001
// Similarly you can modify any details you want before saving the installation 
return ins;
 }

pre_admin_import_save

Description 
This filter allows you to modify the installation details before it is saved while importing the installation (by admin/CLI).

Note : This filter is available since Softaculous version 5.3.4
Note : This filter is executed only when installations are imported by Admin from GUI or Command Line

Usage 
Uncomment the following part inside filter.php and add your code inside the function pre_admin_import_save:

insert_filter('pre_admin_import_save', 'my_pre_admin_import_save', 1, 1);
 function my_pre_admin_import_save($ins){
// If you would like to save a WordPress installation into your custom WordPress package you can update SID 
$ins['sid'] = 10001; // This will save the SID of the installation to 10001
// Similarly you can modify any details you want before saving the installation 
return ins;
 }

pre_upgrade_plugins

Description 
This filter allows you to make changes to the outdated plugins list (add or remove) before upgrading the same

Note : This filter is available since Softaculous version 5.4.4

Usage 
Uncomment the following part inside filter.php and add your code inside the function pre_upgrade_plugins:

insert_filter('pre_upgrade_plugins', 'my_pre_upgrade_plugins', 1, 3);
function my_pre_upgrade_plugins($outdated_plugins, $soft, $username){
    // If you want to remove any plugin before upgrading 
    unset($outdated_plugins['pagelayer/pagelayer.php']); 
    // Return the $outdated_plugins array to continue with plugins upgrade 
    return $outdated_plugins;
 }

Parameters
$outdated_plugins : (array) This is an array with the list of outdated plugins that will be upgraded. You can make changes in this array and return the updated array.
$soft : (int) This is the id of the script for which plugins are being upgraded
$username : (string) This contains the username for which the upgrades are being done

Structure of $outdated_plugins parameter is as follows :

Array( 
        [pagelayer/pagelayer.php] => stdClass Object (  
                [id] => w.org/plugins/pagelayer  
                [slug] => pagelayer  
                [plugin] => pagelayer/pagelayer.php  
                [new_version] => 1.1.0  
                [url] => https://wordpress.org/plugins/pagelayer/
                [package] => http://downloads.wordpress.org/plugin/pagelayer.1.1.0.zip  
                [tested] => 5.4  
                [requires_php] => 5.5  
                [compatibility] => Array ( )  
                [Name] => PageLayer  
        ) 
)

pre_upgrade_themes

Description 
This filter allows you to make changes to the outdated themes list (add or remove) before upgrading the same

Note : This filter is available since Softaculous version 5.4.4

Usage 
Uncomment the following part inside filter.php and add your code inside the function pre_upgrade_themes:

insert_filter('pre_upgrade_themes', 'my_pre_upgrade_themes', 1, 3);
function my_pre_upgrade_themes($outdated_themes, $soft, $username){
    // If you want to remove any theme before upgrading 
    unset($outdated_themes['twentytwenty']); 
    // Return the $outdated_themes array to continue with themes upgrade 
    return $outdated_themes;
 }

Parameters
$outdated_themes: (array) This is an array with the list of outdated themes that will be upgraded. You can make changes in this array and return the updated array.
$soft : (int) This is the id of the script for which themes are being upgraded
$username : (string) This contains the username for which the upgrades are being done

Structure of $outdated_themes parameter is as follows :

Array( 
  [twentytwenty] => stdClass Object ( 
          [name] => Twenty Twenty 
          [slug] => twentytwenty
          [version] => 1.2 
          [preview_url] => https://wp-themes.com/twentytwenty 
          [author] => wordpressdotorg
          [screenshot_url] => //ts.w.org/wp-content/themes/twentytwenty/screenshot.png?ver=1.2 
          [rating] => 84
          [num_ratings] => 34 
          [downloaded] => 757989
          [last_updated] => 2020-03-31 
          [homepage] => https://wordpress.org/themes/twentytwenty/ 
          [download_link] => http://downloads.wordpress.org/theme/twentytwenty.1.2.zip 
      ) 
  ) 
)

post_header

Description 
This filter allows you to print any custom message after Softaculous header is loaded, this filter will be called on all pages after loading the header

Note : This filter is available since Softaculous version 5.4.9

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_post_header:

insert_filter('post_header', 'my_post_header', 1);
function my_post_header(){
    echo 'This is a custom message';
}

post_load_sets

Description 
This filter allows you to modify the WordPress sets loaded. This filter includes both admin and enduser sets list.

Note : This filter is available since Softaculous version 5.5.0

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_post_load_sets:

insert_filter('post_load_sets', 'my_post_load_sets', 1, 1);
function my_post_load_sets($sets){
// To remove an admin set from the list 
// Note : _admin is added at the end of set name for admin sets 
unset($sets['SET_NAME_admin']); 

// To remove an enduser set from the list 
unset($sets['SET_NAME']); 

// To set the default state of the set as checked for installation 
$sets['SET_NAME']['default_value'] = 1; 

return $sets;
}

Parameters
$sets: (array) This is an array with the list of WordPress sets added by admin/endusers. You can make changes in this array and return the updated array.

Structure of the $sets array

Array
(
    [SET_NAME_admin] => Array
        (
            [plugins] => Array
                (
                    [loginizer] => Loginizer
                )
            [default_value] => 0 
            [themes] => Array 
                ( 
                    [twentytwenty] => Twenty Twenty 
                ) 
            [admin_set] => 1 
        )
)

post_load_sets_admin

Description 
This filter allows you to modify the admin WordPress sets loaded. This filter includes only admin sets list.

Note : This filter is available since Softaculous version 5.5.0

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_post_load_sets_admin:

insert_filter('post_load_sets_admin', 'my_post_load_sets_admin', 1, 1);
function my_post_load_sets_admin($sets){
// To remove an admin set from the list 
// Note : _admin is added at the end of set name for admin sets 
unset($sets['SET_NAME_admin']); 

// To set the default state of the set as checked for installation 
$sets['SET_NAME_admin']['default_value'] = 1; 

return $sets;
}

Parameters
$sets: (array) This is an array with the list of WordPress sets added by admin. You can make changes in this array and return the updated array.

Structure of the $sets array

Array
(
    [SET_NAME_admin] => Array
        (
            [plugins] => Array
                (
                    [loginizer] => Loginizer
                )
            [default_value] => 0 
            [themes] => Array 
                ( 
                    [twentytwenty] => Twenty Twenty 
                ) 
            [admin_set] => 1 
        )
)

SOFT_RSYNC_BIN

Description 
The SOFT_RSYNC_BIN filter allows you to copy files/folders using the rynsc command instead of PHP during clone, staging, and push to live of an installation.

Note : This filter is available since Softaculous version 5.8.7

Usage 
Uncomment the following line in filter.php and provide the rsync path

define('SOFT_RSYNC_BIN', '/usr/bin/rsync');

SOFT_DB_BACKUP_BIN

Description 
The SOFT_DB_BACKUP_BIN filter allows you to take backup of your database using mysqldump command instead of PHP.

Note : This filter is available since Softaculous version 5.8.7

Usage 
Uncomment the following line in filter.php and provide the mysqldump path

define('SOFT_DB_BACKUP_BIN', '/usr/bin/mysqldump');

SOFT_DB_RESTORE_BIN

Description 
The SOFT_DB_RESTORE_BIN filter allows you to restore your databse using mysql command instead of PHP.

Note : This filter is available since Softaculous version 5.8.7

Usage 
Uncomment the following line in filter.php and provide the mysql path

define('SOFT_DB_RESTORE_BIN', '/usr/bin/mysql');

SOFT_REMOVE_BIN

Description 
Use the SOFT_REMOVE_BIN filter to remove installation files using the rm command instead of PHP

Note : This filter is available since Softaculous version 5.8.7

Usage 
Uncomment the following line in filter.php and provide the rm path

define('SOFT_REMOVE_BIN', '/usr/bin/rm');

pre_replace_data

Description 
Use pre_replace_data filter to provide custom replace data during wp-cli search and replace command used to replace values in WordPress database during Clone, Staging, Push to Live and Remote Import features.

Note : This filter is available since Softaculous version 5.8.7

Usage 
Uncomment the following part inside filter.php and add your code inside the function pre_replace_data

insert_filter('pre_replace_data', 'my_pre_replace_data', 1, 1);

function my_pre_replace_data($replace_data){
	global $soft, $globals, $source_data, $__settings;
	
	// Do stuff here e.g. is as follows
	if(is_wordpress($soft)){
		//Do things only if its WordPress
		// Define your own replace_data array
		$replace_data = array();
		$replace_data[$source_data['softurl']] = $__settings['softurl'];
		$replace_data[$source_data['softpath']] = $__settings['softpath'];
	}

	return $replace_data;
}

Parameters 

$replace_data: (array) This contains existing data that will be used during the wp-cli search and replace command. The key of the array should contain the source value and value for the exact same key should be the value to be replaced.

clone_rsync_command

Description 
Use the clone_rsync_command filter to provide additional options to make any changes to the rsync command during the cloning of an installation.

Note : This filter is available since Softaculous version 5.8.7

Usage 
Uncomment the following part inside filter.php and add your code inside the function clone_rsync_command:

insert_filter('clone_rsync_command', 'my_soft_rsync_command', 1, 1);

function my_soft_rsync_command($command){
	global $soft;
	
	// Do stuff here e.g. is as follows
	if(is_wordpress($soft)){
		// Do things only if its WordPress
		$command .= " --delete"; //Make changes in rsync command as per your need
	}
	return $command;
}

Parameters 

$command: (string) This contains the rsync command used during cloning of an installation

staging_rsync_command

Description 
Use the staging_rsync_command filter to provide additional options to make any changes to the rsync command during the staging of an installation.

Note : This filter is available since Softaculous version 5.8.7

Usage 
Uncomment the following part inside filter.php and add your code inside the function  staging_rsync_command:

insert_filter('staging_rsync_command', 'my_soft_rsync_command', 1, 1);

function my_soft_rsync_command($command){
	global $soft;
	
	// Do stuff here e.g. is as follows
	if(is_wordpress($soft)){
		// Do things only if its WordPress
		$command .= " --delete"; //Make changes in rsync command as per your need
	}
	return $command;
}

Parameters 

$command: (string) This contains the rsync command used during staging of an installation

pushtolive_rsync_command

Description 
Use the pushtolive_rsync_command filter to provide additional options to make any changes to the rsync command during the push to live of an installation.

Note : This filter is available since Softaculous version 5.8.7

Usage 
Uncomment the following part inside filter.php and add your code inside the function pushtolive_rsync_command:

insert_filter('pushtolive_rsync_command', 'my_soft_rsync_command', 1, 1);

function my_soft_rsync_command($command){
	global $soft;
	
	// Do stuff here e.g. is as follows
	if(is_wordpress($soft)){
		// Do things only if its WordPress
		$command .= " --delete"; //Make changes in rsync command as per your need
	}
	return $command;
}

Parameters 

$command: (string) This contains the rsync command used during push to live

exclude_files_clone

Description 
This filter allows you to exclude files/folders from being copied to the clone installation.

Note : This filter is available since Softaculous version 5.5.6

Usage 
Uncomment the following part inside filter.php and add your code inside the function exclude_files_clone:

insert_filter('exclude_files_clone', 'my_exclude_files_clone', 1, 2);
function my_exclude_files_clone($exclude_files, $softpath){
// $exclude_files is expected as an array 
// Add files/folders to be excluded 
     $exclude_files[] = $softpath.'/.htaccess'; 
     $exclude_files[] = $softpath.'/cache'; 
     return $exclude_files;
}

Parameters 
$exclude_files : (array) This will be the list of files to be excluded calculated by Softaculous. You can make changes in this array and return the new array.
$softpath : (string) This is the path of the live installation.

exclude_files_staging

Description 
This filter allows you to exclude files/folders from being copied to the staging installation.

Note : This filter is available since Softaculous version 5.5.6

Usage 
Uncomment the following part inside filter.php and add your code inside the function exclude_files_staging:

insert_filter('exclude_files_staging', 'my_exclude_files_staging', 1, 2);
function my_exclude_files_staging($exclude_files, $softpath){
// $exclude_files is expected as an array 
// Add files/folders to be excluded 
      $exclude_files[] = $softpath.'/.htaccess'; 
      $exclude_files[] = $softpath.'/cache'; 
      return $exclude_files;
}

Parameters 
$exclude_files : (array) This will be the list of files to be excluded calculated by Softaculous. You can make changes in this array and return the new array.
$softpath : (string) This is the path of the live installation.

exclude_files_pushtolive

Description 
This filter allows you to exclude files/folders from being copied from staging installation to live installation.

Note : This filter is available since Softaculous version 5.5.6

Usage 
Uncomment the following part inside filter.php and add your code inside the function exclude_files_pushtolive:

insert_filter('exclude_files_pushtolive', 'my_exclude_files_pushtolive', 1, 2);
function my_exclude_files_pushtolive($exclude_files, $softpath){
// $exclude_files is expected as an array 
// Add files/folders to be excluded 
       $exclude_files[] = $softpath.'/.htaccess'; 
       $exclude_files[] = $softpath.'/cache'; 
       return $exclude_files;
}

Parameters 
$exclude_files : (array) This will be the list of files to be excluded calculated by Softaculous. You can make changes in this array and return the new array.
$softpath : (string) This is the path of the staging installation.

exclude_files_remoteimport

Description 
This filter allows you to exclude files/folders from being imported.

Note : This filter is available since Softaculous version 5.5.6

Usage 
Uncomment the following part inside filter.php and add your code inside the function exclude_files_remoteimport:

insert_filter('exclude_files_remoteimport', 'my_exclude_files_remoteimport', 1, 2);
function my_exclude_files_remoteimport($exclude_files, $softpath){
// $exclude_files is expected as an array 
// Add files/folders to be excluded 
       $exclude_files[] = $softpath.'/.htaccess'; 
       $exclude_files[] = $softpath.'/cache'; 
       return $exclude_files;
}

Parameters 
$exclude_files : (array) This will be the list of files to be excluded calculated by Softaculous. You can make changes in this array and return the new array.
$softpath : (string) This is the path of the installation which is to be imported.

exclude_files_backup

Description 
This filter allows you to exclude files/folders from being backup.

Note : This filter is available since Softaculous version 5.5.6

Usage 
Uncomment the following part inside filter.php and add your code inside the function exclude_files_backup:

insert_filter('exclude_files_backup', 'my_exclude_files_backup', 1, 2);
function my_exclude_files_backup($exclude_files, $softpath){
// $exclude_files is expected as an array 
// Add files/folders to be excluded 
       $exclude_files[] = $softpath.'/.htaccess'; 
       $exclude_files[] = $softpath.'/cache'; 
       return $exclude_files;
}

Parameters 
$exclude_files : (array) This will be the list of files to be excluded calculated by Softaculous. You can make changes in this array and return the new array.
$softpath : (string) This is the path of the backup installation.

get_current_url

Description 
This filter allows you to modify the current url detected by Softaculous.

Note : This filter is available since Softaculous version 5.6.4

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_get_current_url:

insert_filter('get_current_url', 'my_get_current_url', 1, 1);
 // @param    array $url The detected URL
 function my_get_current_url($url){
     global $soft, $software, $globals;
     // Change the URL here 
     //$url = str_replace(':2083', '', $url); 
     return $url;
 }

Parameters 
$url: (string) This will be the url detected by Softaculous.

pre_software_overview_theme

Description 
The pre_software_overview_theme filter allows you to print some message on the screen before the overview of a software is displayed.

Note : This filter is available since Softaculous version 6.0.1

Parameters

KeyValueDescription
$softintContains the script id of the script for which the Overview is being rendered

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_pre_software_overview_theme:

insert_filter('pre_software_overview_theme', 'my_pre_software_overview_theme', 1, 1);
 function my_pre_software_overview_theme($soft){
	if(is_wordpress($soft)){
		// Print some message on WordPress Overview page
	}
	
	// Print some message on Overview page of all scripts
	
	return true;
 }

pre_software_setup_theme

Description 
The pre_software_setup_theme filter allows you to print custom message on the install form of a software being rendered.

Note : This filter is available since Softaculous version 6.0.1

Parameters

KeyValueDescription
$softintContains the script id of the script for which the Install form is being rendered

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_pre_software_setup_theme:

insert_filter('pre_software_setup_theme', 'my_pre_software_setup_theme', 1, 1);
 function my_pre_software_setup_theme($soft){
	$html = '';
	
	if(is_wordpress($soft)){
		// Print some message on WordPress Install page
	}
	
	// Print some message on Install page of all scripts
	
	$html = 'This is a test message';
	
	return $html;
 }

post_insid_generated

Description 
The post_insid_generated filter allows you to change the installation id (insid) generated by Softaculous during installation, cloning, staging, etc.

Note : This filter is available since Softaculous version 5.8.4

Parameters

KeyValueDescription
$insidintContains the insid generated by Softaculous which you can modify and return

Usage 
Uncomment the following part inside filter.php and add your code inside the function post_insid_generated:

insert_filter('post_insid_generated', 'my_post_insid_generated', 1, 1);
 function my_post_insid_generated($insid){
     global $soft; // $soft will have the sid of the script currently being installed, cloned, staged, etc
     // Use your algorithm to generate the insid 
     $insid = mt_rand(100000,999999); 
     return $insid;
 }

lang_loaded

Description 
Use the lang_loaded filter to perform any action after a language file is loaded. E.g. changing the language strings to custom translations.

Note : This filter is available since Softaculous version 5.8.7

Usage 
Uncomment the following part inside filter.php and add your code inside the function lang_loaded :

insert_filter('lang_loaded', 'my_lang_loaded', 1, 2);

ffunction my_lang_loaded($language, $file){
	
	global $l;
	
	// Add your custom translations here
	if($language == 'english' && $file == 'software'){
		$l['choose_domain_exp'] = 'My custom description for choose domain';
	}
}

Parameters 

$language : (string) This contains the language being served in Softaculous e.g. english, french, etc

$file : (string) This contains the language file being loaded e.g. software, installations, userindex, etc

feature_suggestions

Description 
The feature_suggestions filter allows you to modify the features suggestions generated by Softaculous.

Note : This filter is available since Softaculous version 5.8.4

KeyValueDescription
$loaded_suggestionsarray/RequiredThe features suggestion array loaded by Softaculous which you can modify
$actstring/RequiredThe page user is currently accessing and the suggestions will be shown

Usage 
Uncomment the following part inside filter.php and add your code inside the function feature_suggestions:

insert_filter('feature_suggestions', 'my_feature_suggestions', 1, 2);
 function my_feature_suggestions($loaded_suggestions, $act){
     $loaded_suggestions['wordpress_manager'] = array(
     'title' => 'WordPress Manager',
     'description' => 'Manage your WordPress installations from one place using the WordPress Manager feature',
     'link' => 'https://www.softaculous.com/docs/enduser/wordpress-manager/'
   );
   return $loaded_suggestions;
 }

cli_act

Description 
The cli_act filter allows you to define a custom CLI act

Note : This filter is available since Softaculous version 6.0.1

Parameters

KeyValueDescription
$actstringThe current CLI act being passed in the CLI command
$cli_dataarrayAll parameters passed to the CLI command

Usage 
Uncomment the following part inside filter.php and add your code inside the function cli_act:

insert_filter('cli_act', 'my_cli_act', 1, 2);
function my_cli_act($act, $cli_data){
	global $argv, $globals, $softpanel, $l, $error, $SESS, $user, $server;
	
	if($act == '--custom-act'){
		include_once($globals['path'].'/custom-act.php');
		exit(0);
	}
	
	return true;
	
}

add_domain_page

Description 
The add_domain_page filter allows you to modify the add domain page where the user will be redirected if there is no domain present in their account.

Note : This filter is available since Softaculous version 6.0.1

Note : This filter is works only in Softaculous Remote

Parameters

KeyValueDescription
$pagestringThe default add domain page in Softaculous Remote

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_add_domain_page:

insert_filter('add_domain_page', 'my_add_domain_page', 1, 1);
function my_add_domain_page($page){
	global $argv, $globals, $softpanel, $l, $error, $SESS, $user, $server;
	
	// The return value must be a valid act
	return 'custom_addsite';
	
}

fetch_db_details

Description 
The fetch_db_details will be called before showing the option to allow Softaculous to fetch the database config details if the database connection fails with the existing credentials.

Note : This filter is available since Softaculous version 6.0.2

Parameters

KeyValueDescription
$statusBooleanThe default value will be true, which will show the checkbox.

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_fetch_db_details:

insert_filter('fetch_db_details', 'my_fetch_db_details', 1, 1);

function my_fetch_db_details($status){

	// Default status is true
	// Return true to show the checkbox and false to not show the checkbox to automatically detect database credentials
	return true;
}

wordpress_manager_icon_link

Description 
The wordpress_manager_icon_link will be called before registering the Softaculous WordPress Manager Icon to change the Softaculous WordPress Manager Icon link.

Note : This filter is available since Softaculous version 6.0.2 and only available for cPanel.

Note : You need to rebuild the WordPress Manager icon every time to reflect the changes.

Parameters

KeyValueDescription
$urlStringCurrent softaculous WP Manager link.

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_wordpress_manager_icon_link:

insert_filter('wordpress_manager_icon_link', 'my_wordpress_manager_icon_link', 1, 1);

function my_wordpress_manager_icon_link($url){
	
	//add your custom url here Eg: softaculous/index.live.php?act=software&soft=10001
	$url = 'softaculous/index.live.php?act=software&soft=10001';
	
	// The return value must be string
	return $url;
	
}

post_aefer_domains_theme

Description 
The post_aefer_domains_theme will be called to print/echo on the Domains list page in Softaculous Remote.

Note : This filter is available since Softaculous version 6.0.2

Note : This filter is works only in Softaculous Remote.

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_post_aefer_domains_theme:

insert_filter('post_aefer_domains_theme', 'my_post_aefer_domains_theme', 1, 1);

function my_post_aefer_domains_theme(){
	// add anything you need to print/echo on the Domains list page in Softaculous Remote
	// echo 'This message is displayed on the domains page';
}

pre_footer_theme

Description 
The pre_footer_theme will be called to print any content before the footer is rendered.

Note : This filter is available since Softaculous version 6.0.2

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_pre_footer_theme:

insert_filter('pre_footer_theme', 'my_pre_footer_theme', 1, 1);

function my_pre_footer_theme(){
	// add anything you need to print/echo before the footer is rendered
	// echo 'This message is displayed before footer';
}

pre_loadftp

Description 
The pre_loadftp will be called to trigger your function before loading the ftp connection for the domain in Softaculous Remote.

Note : This filter is available since Softaculous version 6.0.2

Note : This filter works only in Softaculous Remote.

Parameters

KeyValueDescription
$resarrayDomain data fetched from the database.
$domstringDomain/installation data whose FTP data is required.
$insidstringInstallation id.

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_pre_loadftp:

insert_filter('pre_loadftp', 'my_pre_loadftp', 1, 3);

// @param	array $res Domain data fetched from the database
// @param	string $dom domain/installation data whose FTP data is required
// @param	string $insid Installation id
function my_pre_loadftp($res, $dom, $insid = ''){
	
	// You can overwrite the FTP credentials here
	$res['server_host'] = 'server.host.com';
	$res['ftp_user'] = 'ftp_username';
	$res['ftp_pass'] = 'ftp_password';
	$res['protocol'] = 'ftps'; // Supported protocols ftp/ftps/sftp
	$res['ftp_encrypted'] = 0;
	$res['ftp_path'] = '/public_html'; // relative path to domain directory after FTP connection
	$res['diff_path'] = '/home/user1'; // full path in which FTP user lands
	$res['backup_dir'] = '/home/user1/backups'; // full path to the directory where you would like to store Softaculous Backups
	
	return $res;
}

wpcli_search_replace_command

Description 
The wpcli_search_replace_command will be called to modify the WP CLI Search and Replace command during clone, staging, and push to live.

Note : This filter is available since Softaculous version 6.0.2

Parameters

KeyValueDescription
$commandstringThe search and replace command

Usage 
Uncomment the following part inside filter.php and add your code inside the function my_wpcli_search_replace_command:

insert_filter('wpcli_search_replace_command', 'my_wpcli_search_replace_command', 1, 1);

function my_wpcli_search_replace_command($command){
	global $soft;
	
	$dbprefix = __wp_get_dbprefix();
	
	// Do stuff here e.g. is as follows
	if(is_wordpress($soft)){
		// $command .= " --skip-tables=".$dbprefix."users"; //Make changes in search and replace command as per your need
	}
	return $command;
}

Define PHP Version

You can also define the PHP version in the Pre Install Filter if you are using multiple PHP versions on your server.

  • Uncomment the part defining pre_install filter as explained above.
  • Add your code to Identify the PHP version in the function my_pre_install()
insert_filter('pre_install', 'my_pre_install', 1); 
function my_pre_install(){ 
global $soft, $software, $globals; 
// Your Code to Identify the PHP version 
$version = phpversion(); 
define('php_version', $version); 
} 
  • If the PHP version is defined here then Softaculous will skip its process to detect the PHP version while installing a Script.
  • The above example is for pre_install filter. You can similarly configure the pre_upgrade and pre_clone filter to skip the php version check during the upgrade and clone process respectively.

Define PERL Version

You can also define the PERL version in the Pre Install Filter.

  • Uncomment the part defining pre_install filter as explained above.
  • Define the PERL version in the function you used while adding the pre install filter (my_pre_install() in this case)
insert_filter('pre_install', 'my_pre_install', 1);
 function my_pre_install(){
 global $soft, $software, $globals;
 // Your Code to Identify the PERL version
define('perl_version', '5.8.8'); 
} 
  • If the PERL version is defined here then Softaculous will skip its process to detect the PERL version while installing a Script.
  • The above example is for pre_install filter. You can similarly configure the pre_upgrade and pre_clone filter to skip the PERL version check during the upgrade and clone process respectively.

Define MySQL Version

You can also define the MySQL version in the Pre Install Filter.

  • Uncomment the part defining pre_install filter as explained above.
  • Define the MySQL version in the function my_pre_install()
insert_filter('pre_install', 'my_pre_install', 1); 
function my_pre_install(){ 
global $soft, $software, $globals; 
// Your Code to Identify the MySQL version 
define('mysql_version', '5.7.0'); 
} 
  • If the MySQL version is defined here then Softaculous will skip its process to detect the MySQL version while installing a Script.
  • The above example is for pre_install filter. You can similarly configure the pre_upgrade and pre_clone filter to skip the MySQL version check during the upgrade and clone process respectively.

Define Loaded Extensions

You can also define the list of enabled PHP extensions in the Pre Install Filter.

  • Uncomment the part defining pre_install filter as explained above.
  • Define the list of enabled PHP extensions in the function my_pre_install()
insert_filter('pre_install', 'my_pre_install', 1);
function my_pre_install(){ 
global $soft, $software, $globals, $__hooks; 
// E.g 
$__hooks['loaded_extension'] = array('mysqli', 'curl', 'gd');         
//If $__hooks['loaded_extension'] is the only extension loaded list and you do not want Softaculous to detect the extensions, then you can define the following constant.
define('PHP_EXT_EXHAUSTIVE', 1); 
} 
  • If the extension is defined as enabled here then Softaculous will skip its process to detect the PHP extension enabled while installing a Script.
  • The above example is for pre_install filter. You can similarly configure the pre_upgrade and pre_clone filter to skip the PHP extensions check during the upgrade and clone process respectively.

Define Functions Enabled

You can also define the list of enabled PHP functions in the Pre Install Filter.

  • Uncomment the part defining pre_install filter as explained above.
  • Define the list of enabled PHP functions in the function my_pre_install()
insert_filter('pre_install', 'my_pre_install', 1); 
function my_pre_install(){ 
global $soft, $software, $globals, $__hooks; 
// E.g 
$__hooks['function_exists'] = array('phpinfo', 'exec','shell_exec'); 
} 
  • If the function is defined as enabled here then Softaculous will skip its process to detect the PHP function enabled while installing a Script.
  • The above example is for pre_install filter. You can similarly configure the pre_upgrade and pre_clone filter to skip the PHP function exists check during the upgrade and clone process respectively.

Change PHP Version using .htaccess

.htaccess is used by many web hosts to change PHP version for their users. You can do this using Softaculous for the scripts that require a certain minimum PHP version.

Note : This example assumes that you run PHP 5.6 as default for the user and this filter will switch the version to PHP 7.2.

  • Add the following code in the file /path/to/softaculous/enduser/hooks/filter.php
insert_filter('pre_install', 'my_pre_install', 1); 
function my_pre_install(){ global $soft, $software, $globals, $scripts;
 // Do stuff here e.g. is as follows 
 // $scripts[$soft]['php_min'] holds the minimum PHP required by the script currently being installed
if($scripts[$soft]['php_min'] >= '7.2'){
 $version = '7.2.0';
 define('php_version', $version); 
}
} 
  • This pre install filter will skip the PHP version check by Softaculous.
  • Now you have to create the .htaccess file with the content to switch PHP version to 7.3
  • Add the following code to my_post_install() function in the file /path/to/softaculous/enduser/hooks/filter.php
insert_filter('post_install', 'my_post_install', 1, 1);
// @param   array $installation Details of the new installation 
function my_post_install($installation){
 global $soft, $software, $globals, $scripts; 
// Do stuff here e.g. is as follows 
// $scripts[$soft]['php_min'] holds the minimum PHP required by the script currently being installed
if($scripts[$soft]['php_min'] >= '7.3'){
 $data = "AddHandler application/x-httpd-php73 .php\n"; 
if(sfile_exists($installation['softpath'].'/.htaccess')){
 $tmp_data = sfile($installation['softpath'].'/.htaccess'); 
if(!preg_match('/AddHandler(\s*?)application/is', $tmp_data)){
 $data .= $tmp_data; 
}
} 
swrite($installation['softpath'].'/.htaccess', $data, 1); 
}
 } 
  • This will create the .htaccess file with the required content and if the script has a .htaccess then it will write the content to the existing file.
  • Now we also need to define the PHP version during the Upgrade process.
  • Add the following code to my_pre_upgrade() function in the file /path/to/softaculous/enduser/hooks/filter.php
insert_filter('pre_upgrade', 'my_pre_upgrade', 1, 1); 
// @param   array $installation Details of the installation being upgraded 
function my_pre_upgrade($installation){ 
global $soft, $software, $globals, $scripts; 
// Do stuff here e.g. is as follows
// $scripts[$soft]['php_min'] holds the minimum PHP required by the script currently being installed
 if($scripts[$soft]['php_min'] >= '7.3'){
 $version = '7.3.0'; 
define('php_version', $version);
 }
 } 
  • This pre upgrade filter will skip the PHP version check by Softaculous.
  • Now you have to create the .htaccess file with the content to switch PHP version to 7.3
  • Add the following code to my_post_upgrade() function in the file /path/to/softaculous/enduser/hooks/filter.php
insert_filter('post_upgrade', 'my_post_upgrade', 1, 1); 
// @param   array $installation Details of the installation upgraded
function my_post_upgrade($installation){
 global $soft, $software, $globals, $scripts; 
// Do stuff here e.g. is as follows 
// $scripts[$soft]['php_min'] holds the minimum PHP required by the script currently being installed
if($scripts[$soft]['php_min'] >= '7.3'){
 $data = "AddHandler application/x-httpd-php73 .php\n"; 
if(sfile_exists($installation['softpath'].'/.htaccess')){ 
$tmp_data = sfile($installation['softpath'].'/.htaccess'); 
if(!preg_match('/AddHandler(\s*?)application/is', $tmp_data)){
 $data .= $tmp_data; 
}
 } 
swrite($installation['softpath'].'/.htaccess', $data, 1); 
}
 } 
  • This will create the .htaccess file with the required content if the content does not exist.
  • Thats it you have the filter configured to switch PHP version.
Was this helpful to you?