FOR ARCHIVAL PURPOSES ONLY

The information in this wiki hasn't been maintained for a good while. Some of the projects described have since been deprecated.

In particular, the "Ushahidi Platform v3.x" section contains information that is often misleading. Many details about this version of Platform have changed since.

This website is an extraction of the original Ushahidi wiki into a static form. Because of that, functions like logging in, commenting or searching will not work.

For more documentation, please refer to https://docs.ushahidi.com

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

Plugin Filter

Introduction

Filters are callback functions that modify content before it is rendered to the user on the browser. Filters can also be applied before content is saved in the database.

In the example below, the filter plugin access the single report title and modifies it before it's rendered to the user on the browser.

Example:

Code Block
languagephp
<?php
// My Plugin

// Add the filter and call the function modify_title
Event::add('ushahidi_filter.report_title', 'modify_title');

function modify_title()
{
	// Access the report title
	$report_title = Event::$data;

	// Make changes to the report title
	$new_report_title = str_replace("&", "_", $report_title);

	// Return new Title
	Event::$data = $new_report_title;
}
?>

Reference

Wiki Markup
{table-plus:sortColumn=1|sortIcon=true}









|| Filter \\ || Parameter \\ || Description \\ || File \\ ||
| admin_header_block \\ | $content | Modify Admin Header Block Javascript And CSS | application/libraries/Themes.php \\ |
| pagination | $pagination \\ | | application/controllers/admin/reports.php \\ |
| filter_incidents | $incidents | | application/controllers/admin/reports.php |
| footer_block \\ | $content | Modify Footer Block Javascript | application/libraries/Themes.php \\ |
| location_name | $form\['location_name'\] | | application/controllers/admin/reports.php |
| location_find | $form\['location_find'\] | | application/controllers/admin/reports.php |
| report_download_csv_header \\ | $custom_headers | | application/controllers/admin/reports.php |
| report_download_csv_incident \\ | $event_data | Add some custom data for an incident | application/controllers/admin/reports.php |
| json_index_features\\ | $json_features | Alter /json json_features array before its passed through json_encode | application/controllers/json.php |
| json_cluster_features | $json_features\\ | Alter /json/cluster json_features array before its passed through json_encode\\ | application/controllers/json.php\\ |
| json_single_features | $json_features\\ | Alter /json/single/ID json_features array before its passed through json_encode\\ | application/controllers/json.php\\ |
| json_share_feature | $json_features\\ | Alter /json/share json_features array before its passed through json_encode\\ | application/controllers/json.php\\ |
| map_main | $div_map | Modify Main Map Block | application/controllers/main.php |
| map_timeline | $div_timeline | Modify Main Map Block | application/controllers/main.php |
| active_startDate | $display_startDate | | application/controllers/main.php |
| active_endDate | $display_endDate | | application/controllers/main.php |
| startDate | $startDate | | application/controllers/main.php |
| endDate | $endDate | | application/controllers/main.php |
| page_title | | Modify Page Title | application/controllers/page.php |
| page_description | | Modify Page Description | application/controllers/page.php |
| report_title | $incident_title | Modify report title \\ | application/controllers/reports.php |
| report_description | $incident_description | Modify report description \\ | application/controllers/reports.php |
| map_base_layers | $layers | Add custom map layers \\ | application/helpers/map.php \\ |
| map_layers_js \\ | $js | Alter map layers JS | application/helpers/map.php |
| fetch_incidents_set_params | $params | Modify parameters for reports \\ | application/helpers/reports.php |
| message_sms_from | $from \\ | Modification of the values from the SMS gateway | application/helpers/sms.php |
| message_sms | $message \\ | Modification of the values from the SMS gateway | application/helpers/sms.php |
| header_block \\ | $content | Modify Header Block Javascript And CSS | application/libraries/Themes.php \\ |
| header_js \\ | $inline_js | Modify Header Javascript | application/libraries/Themes.php \\ |
| report_stats | $report_stats | Modify reports list statistics | themes/default/view/reports.php \\ |
| comment_block \\ | $comments | | themes/default/views/reports_view.php; themes/polaroid/views/reports_view.php |
| comment_form_block | $comments_form | | themes/default/views/reports_view.php; themes/polaroid/views/reports_view.php |
| get_incidents_sql | $sql | Alter SQL for fetching incidents (use with caution) | application/models/incident.php |
| get_neighbouring_incidents_sql | $sql | Alter SQL for fetching neighbouring incidnets (use with caution) | application/models/incident.php |
| view_pre_render | $local_data | Add extra data to a view | application/libraries/MY_View.php |
| view_pre_render.VIEW_NAME | $local_data | Add extra data to a view. Same as above but only triggered for a specific view. Replace VIEW_NAME with the real view name ie. "ushahidi_filter.view_pre_render.reports_main" (note the view is actually reports/main.php, / is replaced by _) | application/libraries/MY_View.php |
{table-plus}