Skip to content

Commit

Permalink
Merge pull request #18 from bu-ist/send-json
Browse files Browse the repository at this point in the history
use native wp_send_json, readme fixes
  • Loading branch information
jdub233 authored Jul 11, 2017
2 parents d19b2df + c7789cb commit 8094cee
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion admin/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
Expand Down
8 changes: 4 additions & 4 deletions bu-liaison-inquiry.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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 );
}

/**
Expand Down
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 8094cee

Please sign in to comment.