LMS Forms Builder
Filters
stm_lms_profile_form_default_fields_info
Description: This filter allows you to modify or extend the default fields of the Profile Form inside the Form Builder. It is useful when you need to add new input fields or update existing ones for student or instructor profiles.
Parameters:
$profile_form
(Array) — An array of existing form fields with their configuration.
Example usage:
add_filter( 'stm_lms_profile_form_default_fields_info', 'stm_lms_profile_form_default_fields_info_function', 10, 1);
function stm_lms_profile_form_default_fields_info_function( $profile_form ) {
$profile_form[] = array(
'first_name' => array(
'label' => esc_html__( 'First Name', 'masterstudy-lms-learning-management-system-pro' ),
'placeholder' => esc_html__( 'Enter your name', 'masterstudy-lms-learning-management-system-pro' ),
)
);
return $profile_form;
}
Explanation: This example adds a new field called First Name to the Profile Form. The label defines what users see next to the field, while the placeholder defines the input hint inside the field.
stm_lms_form_builder_available_fields
Description: This filter allows you to modify or extend the available field types in the Form Builder. Developers can add new field types (text, textarea, dropdown, etc.) that instructors or admins can use when building forms.
Parameters:
$fields
(Array) — An array of all available field types in the form builder.
Example usage:
add_filter( 'stm_lms_form_builder_available_fields', 'stm_lms_form_builder_available_fields_function', 10 , 1);
function stm_lms_form_builder_available_fields_function($fields){
$fields[] = array(
'type' => 'textarea',
'field_name' => esc_html__( 'Text Area', 'masterstudy-lms-learning-management-system-pro' ),
);
return $fields;
}
Explanation: This example registers a new Textarea field type in the Form Builder. Once added, administrators can use it as a drag-and-drop field when creating custom forms.
Last updated
Was this helpful?