/* FyrePro — callback form installer WITH diagnostics. Reports why it did not run instead of failing silently. */ if ( ! function_exists( 'fyrepro_cb_install' ) ) {function fyrepro_cb_say( $msg, $ok = false ) { printf( '
FyrePro installer: %s
', $ok ? '#065f46' : '#b91c1c', $msg ); }function fyrepro_cb_install() {if ( ! is_user_logged_in() ) { return; } // silent for visitors if ( ! current_user_can( 'manage_options' ) ) { return; } // silent for non-adminsif ( ! class_exists( 'GFAPI' ) ) { fyrepro_cb_say( 'Gravity Forms is not loaded (GFAPI missing). The code ran, but GF was not available at this point.' ); return; }$existing = get_option( 'fyrepro_callback_form_id' ); if ( $existing ) { $form = GFAPI::get_form( $existing ); if ( $form ) { fyrepro_cb_say( 'Already created earlier. FORM ID = ' . (int) $existing . ' ("' . esc_html( $form['title'] ) . '"). Nothing more to do.', true ); } else { delete_option( 'fyrepro_callback_form_id' ); fyrepro_cb_say( 'A previous run recorded form ID ' . (int) $existing . ' but that form no longer exists. Flag cleared — reload this page to create it fresh.' ); } return; }$nid = uniqid( '', true ); $cid = uniqid( '', true );$form_id = GFAPI::add_form( array( 'title' => 'LP Callback Request', 'labelPlacement' => 'top_label', 'enableHoneypot' => true, 'button' => array( 'type' => 'text', 'text' => 'Request callback' ), 'fields' => array( array( 'id' => 1, 'type' => 'phone', 'label' => 'Your phone number', 'isRequired' => true, 'phoneFormat' => 'international', 'placeholder' => 'Your phone number' ), array( 'id' => 2, 'type' => 'select', 'label' => 'Best time to call you back', 'choices' => array( array( 'text' => 'Any time in business hours', 'value' => '', 'isSelected' => true ), array( 'text' => 'Early morning, 7am to 9am', 'value' => 'Early morning (7am to 9am)' ), array( 'text' => 'Morning, 9am to 12pm', 'value' => 'Morning (9am to 12pm)' ), array( 'text' => 'Afternoon, 12pm to 4pm', 'value' => 'Afternoon (12pm to 4pm)' ), array( 'text' => 'After hours, after 4pm', 'value' => 'After hours (after 4pm)' ), ) ), array( 'id' => 3, 'type' => 'hidden', 'label' => 'Source', 'defaultValue' => 'LP callback banner' ), ), 'notifications' => array( $nid => array( 'id' => $nid, 'isActive' => true, 'name' => 'Callback request', 'event' => 'form_submission', 'toType' => 'email', 'to' => '{admin_email}', 'from' => '{admin_email}', 'fromName' => 'FyrePro website', 'subject' => 'CALLBACK - {Your phone number:1} - {Best time to call you back:2}', 'message' => "Phone: {Your phone number:1}\nPreferred window: {Best time to call you back:2}\nSource: {Source:3}", ) ), 'confirmations' => array( $cid => array( 'id' => $cid, 'name' => 'Default Confirmation', 'isDefault' => true, 'type' => 'message', 'message' => '

Thanks. We will call you on that number.

', ) ), ) );if ( is_wp_error( $form_id ) ) { fyrepro_cb_say( 'GFAPI::add_form failed — ' . esc_html( $form_id->get_error_message() ) ); return; }update_option( 'fyrepro_callback_form_id', (int) $form_id, false ); fyrepro_cb_say( 'Created. FORM ID = ' . (int) $form_id . '  |  [gravityform id="' . (int) $form_id . '" title="false" description="false" ajax="true"] — note the ID, then delete this snippet.', true ); }if ( did_action( 'wp_loaded' ) ) { fyrepro_cb_install(); } else { add_action( 'wp_loaded', 'fyrepro_cb_install' ); } }
  • Facebook
  • Instagram
  • LinkedIn
Phone: 1800 00 3973 | Email: [email protected]
Fyrepro
  • Home
  • Services Penetrations
    • Passive Fire Protection
    • Mechanical Services
    • Plumbing Services
    • Electrical Services
  • Walls & Ceilings
  • Fire Doors
  • Consultancy
  • Contact
  • Menu Menu

Recent Comments

    Archives

      Categories

      • No categories

      Interesting links

      Here are some interesting links for you! Enjoy your stay :)

      Follow us on Facebook

      • Fire Door Division
      • Passive Fire Division
      • Fire rated Doors
      • Passive Fire Protection
      • Maintenance & Service
      • Fire Protection
      • Service Penetrations
      • Fire Consultant
      © Copyright Fyre Pro 2020 | Website by Media Booth™
      • Facebook
      • Instagram
      • LinkedIn
      Scroll to top