From: Anthony Talarico Date: Fri, 13 May 2016 21:00:55 +0000 (-0400) Subject: added errors to the login and adds audience id automatically X-Git-Tag: v1.0.0^2~4 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=84c60cd17c83749a2eee2c2482286ad2f878861b;p=WP-Plugins%2Fglm-gravityform-streamsend.git added errors to the login and adds audience id automatically --- diff --git a/class-streamsendfeedaddon.php b/class-streamsendfeedaddon.php index e68bbe1..8233033 100644 --- a/class-streamsendfeedaddon.php +++ b/class-streamsendfeedaddon.php @@ -12,6 +12,7 @@ class GFStreamSendAddOn extends GFFeedAddOn protected $_full_path = __FILE__; protected $_title = 'Gravity Forms StreamSend Integration'; protected $_short_title = 'StreamSend'; + protected $_errorFlag = false; private static $_instance = null; protected $streamSendFields = array( @@ -92,7 +93,7 @@ class GFStreamSendAddOn extends GFFeedAddOn 'label' => esc_html__( 'Audience Id', 'StreamSend' ), 'type' => 'text', 'class' => 'small', - 'feedback_callback' => array( $this, 'is_valid_setting' ), + 'feedback_callback' => array( $this, 'is_valid_audience' ), ) ) ) @@ -100,6 +101,18 @@ class GFStreamSendAddOn extends GFFeedAddOn } public function feed_settings_fields() { + $settings = $this->get_plugin_settings(); + $apiLogin = rgar($settings, 'glm_streamsend_login'); + $apiKey = rgar($settings, 'glm_streamsend_key'); + $ss = new StreamSend(STREAMSEND_BASE_URL, $apiLogin, $apiKey); +// echo '
', print_r($ss->listList(),true), '
'; + $lists = $ss->listList(); + $lists = $lists->responseData->list; + for($i = 0; $i < count($lists); $i++){ + + } + + return array( array( 'title' => 'StreamSend Form Settings', @@ -172,6 +185,13 @@ class GFStreamSendAddOn extends GFFeedAddOn 'checkbox_label' => esc_html__( 'Enable Condition', 'StreamSend' ), 'instructions' => esc_html__( 'Process this StreamSend feed if', 'StreamSend' ), ), + array( + 'name' => 'Lists', + 'label' => esc_html__( 'List', 'StreamSend' ), + 'type' => 'select', + 'checkbox_label' => esc_html__( 'Enable Condition', 'StreamSend' ), + 'instructions' => esc_html__( 'Process this StreamSend feed if', 'StreamSend' ), + ), ) ) ); @@ -189,13 +209,35 @@ class GFStreamSendAddOn extends GFFeedAddOn $apiKey = rgar($settings, 'glm_streamsend_key'); $ss = new StreamSend(STREAMSEND_BASE_URL, $apiLogin, $apiKey); $ss->accountList(); - + $responseData[] = $ss->audienceList(); + $audienceId = $responseData[0]->responseData->audience->id; if ( $ss->responseHTTPStatus != 200){ - echo '
'; - esc_html_e( 'Invalid Login or Key', 'gravityforms' ); + echo '
'; + echo '

Invalid Login or API Key

'; echo '
'; } + ?> + + errorFlag){ + echo '
'; + esc_html_e( 'This add-on needs to be updated. Please contact the developer.', 'gravityforms' ); + echo '
'; + } + } + public function __construct() { + parent::__construct(); + } + public function process_feed( $feed, $entry, $form ) { $feedName = $feed['meta']['feedName']; $field_map = $this->get_field_map_fields( $feed, 'mappedFields' );