diff --git a/admin/admin.php b/admin/admin.php index 592b475..5d545de 100644 --- a/admin/admin.php +++ b/admin/admin.php @@ -133,7 +133,7 @@ function bu_liaison_inquiry_options_page_html() { } // Add status messages. - // Wordpress will add the "settings-updated" $_GET parameter to the url. + // WordPress will add the "settings-updated" $_GET parameter to the url. if ( isset( $_GET['settings-updated'] ) ) { // Add settings saved message with the class of "updated". add_settings_error( 'bu_liaison_inquiry_messages', 'bu_liaison_inquiry_message', __( 'Settings Saved', 'bu_liaison_inquiry' ), 'updated' ); diff --git a/bu-liaison-inquiry.php b/bu-liaison-inquiry.php index 9542d23..b7434a2 100644 --- a/bu-liaison-inquiry.php +++ b/bu-liaison-inquiry.php @@ -245,7 +245,7 @@ function handle_liaison_inquiry() { if ( ! wp_verify_nonce( $_REQUEST['liaison_inquiry_nonce'], 'liaison_inquiry' ) ) { $return['status'] = 0; $return['response'] = 'There was a problem with the form nonce, please reload the page'; - echo json_encode( $return ); + wp_send_json( $return ); return; } @@ -258,7 +258,7 @@ function handle_liaison_inquiry() { if ( ! isset( $options['APIKey'] ) ) { $return['status'] = 0; $return['response'] = 'API Key missing'; - echo json_encode( $return ); + wp_send_json( $return ); return; } @@ -282,7 +282,7 @@ function handle_liaison_inquiry() { $return['status'] = 0; $return['response'] = 'Failed submitting to Liaison API. Please retry. Error: ' . $remote_submit->get_error_message(); error_log( sprintf( '%s: %s', __METHOD__, $return['response'] ) ); - echo json_encode( $return ); + wp_send_json( $return ); return; } @@ -297,7 +297,7 @@ function handle_liaison_inquiry() { $return['data'] = ( isset( $resp->data ) ) ? $resp->data : ''; // Return a JSON encoded reply for the validation javascript. - echo json_encode( $return ); + wp_send_json( $return ); } /** diff --git a/readme.md b/readme.md index 7271e90..99f4207 100644 --- a/readme.md +++ b/readme.md @@ -1,16 +1,16 @@ # BU Liaison Inquiry # Inquiry form for Liaison Inc.'s SpectrumEMP enrollment CRM ## Description -This Wordpress plugin provides an inquiry form for prospective students. It uses the SpectrumEMP API to get the form parameters from Liaison, and submit the form data back to Liaison. It is based on example code from `https://github.com/Liaison-Intl/EMP_API-Example` +This WordPress plugin provides an inquiry form for prospective students. It uses the SpectrumEMP API to get the form parameters from Liaison, and submit the form data back to Liaison. It is based on example code from `https://github.com/Liaison-Intl/EMP_API-Example` ## Basic Usage ### Admin -The plugin provides an option page in the Wordpress admin, under the main `Settings` menu called `Liaison API Keys`. Enter the API Key and Client ID provided by Liaison for the relevant account here. +The plugin provides an option page in the WordPress admin, under the main `Settings` menu called `Liaison API Keys`. Enter the API Key and Client ID provided by Liaison for the relevant account here. ### Inquiry Form shortcode Once the API Key and Client ID have been set, the inquiry form can be placed anywhere in the site by using the following shortcode: `[liaison_inquiry_form]` -When the page or post is displayed, the shortcode will be replaced by the Liaison inquiry form. Prospective students can fill out the form and submit it directly from the Wordpress site, and will be redirected to their personal URL on the Spectrum EMP site. +When the page or post is displayed, the shortcode will be replaced by the Liaison inquiry form. Prospective students can fill out the form and submit it directly from the WordPress site, and will be redirected to their personal URL on the Spectrum EMP site. ## Advanced Usage ### Mini-form