FRS Maintenance Log View Status Colors

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

FRS Work Order Dropdown Formatter

/** * 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

FRS Datatables Initialization

/** * Datatables Initialization (Safe Version) * Removes custom jQuery to prevent conflicts with Formidable/WordPress. * Usage: Place [datatables] on any page with a table you want to enhance. */ function frs_register_datatables() { // Styles wp_register_style( ‘DataTables_Styles’, ‘https://cdn.datatables.net/2.1.0/css/dataTables.dataTables.min.css’ ); wp_register_style(…Continue reading

FRS Parent Email Lookup

/** * Get Parent Email Shortcode * Usage: [frs-parent-email] * logic: Finds the Group Owner’s email based on the current user’s group. */ function frsGetParentEmail() { // 1. Use the “Universal Brain” to find the Group ID // This handles…Continue reading

FRS Work Order Number Generator

add_action(‘frm_after_create_entry’, ‘autoIDGenerator’, 30, 2); function autoIDGenerator($entry_id, $form_id ) { // Ensure constants are defined to prevent warnings if ( !defined(‘WORK_ORDER_FORM_KEY’) ) return; switch ($form_id) { case FrmForm::get_id_by_key(WORK_ORDER_FORM_KEY): workOrderNumberGenerator($entry_id); break; default: break; } } function workOrderNumberGenerator($entry_id) { // 1. Get the…Continue reading

Display Only Selected Countries on the Vendor Registration Form

add_action( ‘wp_enqueue_scripts’, static function () { $registration_page_id = (int) get_option( ‘wcv_signup_registration_page_id’, 0 ); if ( 0 === $registration_page_id || ! is_page( $registration_page_id ) ) { return; } $allowed_countries = array( ‘AU’, ‘GB’, ‘US’, ‘CA’ ); // ISO 3166-1 alpha-2 codes…Continue reading

mobile redirect (chatgpt)

// Mobile redirect (admin INCLUDED, cache-friendly) add_action(‘template_redirect’, ‘rd_mobile_redirect’, 10); function rd_mobile_redirect() { // Skip only AJAX/cron/preview/REST to avoid breaking editors & API if (wp_doing_ajax() || wp_doing_cron() || is_preview() || defined(‘REST_REQUEST’)) return; $req_uri = $_SERVER[‘REQUEST_URI’] ?? ‘/’; $path = strtok($req_uri, ‘?’);…Continue reading