Product SiteDocumentation Site

7.6. Custom Functions

Custom functions are used to extend the functionality of MantisBT by integrating user-written functions into the issue processing at strategic places. This allows the system administrator to change the functionality without touching MantisBT's core.
Default Custom Functions are defined in the API file core/custom_function_api.php , and are named custom_function_default_descriptive_name, where descriptive_name describes the particular function. See Section 7.6.1, “Default Custom Functions” for a description of the specific functions.
User versions of these functions (overrides) are named like custom_function_override_descriptive_name, and placed in a file called custom_functions_inc.php that must be saved in MantisBT's config directory. In normal processing, the system will look for override functions and execute them instead of the provided default functions.
The simplest way to create a custom function is to copy the default one from the api to your override file (custom_functions_inc.php), and rename it (i.e. replacing 'default' by 'override'). The specific functionality you need can then be coded into the override function.

7.6.1. Default Custom Functions

Refer to core/custom_functions_api.php for further details.
Custom Function NameDescriptionReturn value
custom_function_default_auth_can_change_password()Determines whether MantisBT can update the passwordTrue if yes, False if not
custom_function_default_changelog_include_issue( $p_issue_id )Determines whether the specified issue should be included in the Changelog or not.True to include, False to exclude
custom_function_default_changelog_print_issue( $p_issue_id, $p_issue_level = 0 )Prints one entry in the ChangelogNone
custom_function_default_enum_categories()Build a list of all categories for the current projectEnumeration, delimited by "|"
custom_function_default_enum_future_versions()Build a list of all future versions for the current projectEnumeration, delimited by "|"
custom_function_default_enum_released_versions()Build a list of all released versions for the current projectEnumeration, delimited by "|"
custom_function_default_enum_versions()Build a list of all versions for the current projectEnumeration, delimited by "|"
custom_function_default_format_issue_summary( $p_issue_id, $p_context = 0 )Format the bug summaryFormatted string
custom_function_default_get_columns_to_view( $p_columns_target = COLUMNS_TARGET_VIEW_PAGE, $p_user_id = null )Defines which columns should be displayedArray of the column names
custom_function_default_issue_create_notify( $p_issue_id )Notify after an issue has been createdIn case of invalid data, this function should call trigger_error()
custom_function_default_issue_create_validate( $p_new_issue_data )Validate field settings before creating an issueIn case of invalid data, this function should call trigger_error()
custom_function_default_issue_delete_notify( $p_issue_data )Notify after an issue has been deletedIn case of invalid data, this function should call trigger_error()
custom_function_default_issue_delete_validate( $p_issue_id )Validate field settings before deleting an issueIn case of invalid data, this function should call trigger_error()
custom_function_default_issue_update_notify( $p_issue_id )Notify after an issue has been updatedIn case of invalid data, this function should call trigger_error()
custom_function_default_issue_update_validate( $p_issue_id, $p_new_issue_data, $p_bugnote_text )Validate field issue data before updatingIn case of invalid data, this function should call trigger_error()
custom_function_default_print_bug_view_page_custom_buttons( $p_bug_id )Prints the custom buttons on the current view pageNone
custom_function_default_print_column_title( $p_column, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE, array $p_sort_properties = null )Print a column's title based on its nameNone
custom_function_default_print_column_value( $p_column, $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE )Print a column's value based on its nameNone
custom_function_default_roadmap_include_issue( $p_issue_id )Determines whether the specified issue should be included in the Roadmap or not.True to include, False to exclude
custom_function_default_roadmap_print_issue( $p_issue_id, $p_issue_level = 0 )Prints one entry in the RoadmapNone