/** * FRS Work Order Assignee Dropdown * Populates the “Assign To” dropdown with ONLY members of the current user’s group. */ add_filter(‘frm_get_field_options’, ‘frs_populate_group_members_dropdown’, 10, 2); function frs_populate_group_members_dropdown($options, $field) { // 1. CONFIGURATION // Use the ID you provided (29800)…Continue reading
/** * FRS Filter Closed Work Orders * Removes non-open work orders from the Maintenance Log dropdown. * OPTIMIZED: Uses 1 query instead of looping queries. */ add_filter(‘frm_setup_new_fields_vars’, ‘frs_removeNonOpenWorkOrders’, 30, 2); add_filter(‘frm_setup_edit_fields_vars’, ‘frs_removeNonOpenWorkOrders’, 30, 2); function frs_removeNonOpenWorkOrders( $values, $field )…Continue reading
/** * FRS PMP Update Sync * Updates the Staff Directory entry when a user changes their Membership Level. * (e.g. Upgrades, Downgrades, or Cancels) */ add_action(‘pmpro_after_change_membership_level’, ‘frs_sync_pmp_update_to_directory’, 10, 2); function frs_sync_pmp_update_to_directory($level_id, $user_id) { // — CONFIGURATION — $target_form_key =…Continue reading
/** * FRS Staff Directory PMP Sync * Adds the user’s PMPro Membership Level Name (e.g. “Team 365”) to the entry. * Uses Direct Field ID: 29401 */ add_action(‘frm_after_create_entry’, ‘frs_add_pmp_level_to_entry’, 10, 2); function frs_add_pmp_level_to_entry($entry_id, $form_id) { // — CONFIGURATION —…Continue reading
/** * FRS Asset Dropdown Formatter * Adds Name & Location to the Asset ID dropdown (e.g., “A-101 – Drill – Warehouse”) * Note: Called via Ajax by Formidable Forms */ function frs_addAssetNameAndLocationToSelectionOption() { // 1. Sanitize Input $options =…Continue reading
/** * FRS SYSTEM CONFIGURATION * Defines the Keys and IDs used by all other FRS snippets. * DO NOT DELETE – The Work Order System relies on this. */ // 1. Form Keys define(“WORK_ORDER_FORM_KEY”, “workorder”); define(“MAINTENANCE_LOG_FORM_KEY”, “maintenanceform3”); define(“ASSET_FORM_KEY”, “inventory2”);…Continue reading
/** * FRS Status Synchronizer * Syncs Status & Completion Date between Work Orders and Maintenance Logs. * Triggered when either form is created or updated. */ add_action(‘frm_after_update_entry’, ‘frs_sync_status_and_date’, 10, 2); add_action(‘frm_after_create_entry’, ‘frs_sync_status_and_date’, 30, 2); function frs_sync_status_and_date($entry_id, $form_id) { //…Continue reading
add_action(‘wp_head’, function () { echo ‘ ‘; });Continue reading
add_shortcode(‘status_color’, function($atts) { $atts = shortcode_atts([‘status’ => ”], $atts); $status = $atts[‘status’]; switch ($status) { case ‘Open’: return ‘‘ . $status . ‘‘; case ‘On Hold’: return ‘‘ . $status . ‘‘; case ‘Closed’: return ‘‘ . $status . ‘‘;…Continue reading
/** * Name: frs_addWorkOrderNameAndDescriptionToSelectionOption * Description: Secured version – Removes “Location” and prevents SQL Injection * Note: Called via Ajax **/ function frs_addWorkOrderNameAndDescriptionToSelectionOption() { // 1. Sanitize the input immediately $options = isset($_POST[“options”]) ? $_POST[“options”] : null; if (empty($options) ||…Continue reading