From SitePad Wiki
Jump to: navigation, search


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

Note : Filters have been added since SitePad version 1.0.7

The following guide will show you how the Server Admin can configure Filter Functions to customize the domains list and several other events.

  • SSH to your server and go to the following path:
  • 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.


  • 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);


Param Type Description
$tag string/Required Action name that triggers the specific function.
$function_to_add string/Required Name of the function to be triggered.
$priority int/optional Priority in which you want the filter to be triggered. (Default is 10)
$accepted_args int/optional Number of arguments accepted by the filter function. (Default is 1)

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

If you would like to make some changes to the user's domains list in SitePad, you will have to rename the file filter.txt to filter.php and uncomment the following part and add the code in my_domains_list() function.

insert_filter('domains_list', 'my_domains_list', 1, 1);

function my_domains_list($domains){
	// Add your custom code here
	$domains[''] = '/home/username/public_html/mydomain/';
	return $domains;

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


The domains_list filter will trigger your function with the list of domains fetched by SitePad using the control panel API. You can use this filter to modify the list of domains as per your preference.

Note : The parameter in this function will be an array which will have the domain name as the key and the full path to the domain as the value.

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

insert_filter('domains_list', 'my_domains_list', 1);

function my_domains_list($domains){
	// Add your custom code here
	$domains[''] = '/home/username/public_html/mydomain/';
	return $domains;