HubSpot – Free Marketing Plugin for WordPress - Version 0.7.2

Version Description

(2014.04.18) = -Bug fixes - Fix contact deletion bug - Implement data recovery fix for contacts - Bug fixes to contact merging

Download this release

Release Info

Developer AndyGCook
Plugin Icon 128x128 HubSpot – Free Marketing Plugin for WordPress
Version 0.7.2
Comparing to
See all releases

Code changes from version 0.7.0 to 0.7.2

admin/inc/class-leadin-contact.php CHANGED
@@ -118,7 +118,7 @@ class LI_Contact {
118
  $sessions['session_' . $cur_array]['events']['event_' . $cur_event]['event_date'] = $event['event_date'];
119
 
120
  // Set the first submission if it's not set and then leave it alone
121
- if ( !$lead->first_visit )
122
  $lead->first_visit = $event['event_date'];
123
 
124
  // Always overwrite the last_submission date which will end as last submission date
@@ -147,7 +147,7 @@ class LI_Contact {
147
  $sessions['session_' . $cur_array]['events']['event_' . $cur_event]['activities'][] = $event;
148
 
149
  // Set the first submission if it's not set and then leave it alone
150
- if ( !$lead->first_submission )
151
  $lead->first_submission = $event['event_date'];
152
 
153
  // Always overwrite the last_submission date which will end as last submission date
118
  $sessions['session_' . $cur_array]['events']['event_' . $cur_event]['event_date'] = $event['event_date'];
119
 
120
  // Set the first submission if it's not set and then leave it alone
121
+ if ( ! isset($lead->first_visit) )
122
  $lead->first_visit = $event['event_date'];
123
 
124
  // Always overwrite the last_submission date which will end as last submission date
147
  $sessions['session_' . $cur_array]['events']['event_' . $cur_event]['activities'][] = $event;
148
 
149
  // Set the first submission if it's not set and then leave it alone
150
+ if ( ! isset($lead->first_submission) )
151
  $lead->first_submission = $event['event_date'];
152
 
153
  // Always overwrite the last_submission date which will end as last submission date
admin/leadin-admin.php CHANGED
@@ -475,8 +475,13 @@ class WPLeadInAdmin {
475
  {
476
  ?>
477
  <div id="leadin-footer">
478
- <p class="support"><a href="http://leadin.com">LeadIn</a> <?php echo LEADIN_PLUGIN_VERSION?> | Need help? <a href="#" onclick="return SnapEngage.startLink();">Contact us</a>.</p>
 
 
 
 
479
  <p class="sharing"><a href="https://twitter.com/leadinapp" class="twitter-follow-button" data-show-count="false">Follow @leadinapp</a>
 
480
  <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script></p>
481
  </div>
482
  <!-- begin SnapEngage code -->
475
  {
476
  ?>
477
  <div id="leadin-footer">
478
+ <p class="support">
479
+ <a href="http://leadin.com">LeadIn</a> <?php echo LEADIN_PLUGIN_VERSION?>
480
+ <span style="padding: 0px 5px;">|</span> Need help? <a href="#" onclick="return SnapEngage.startLink();">Contact us</a>
481
+ <span style="padding: 0px 5px;">|</span> Love Leadin? <a href="http://wordpress.org/support/view/plugin-reviews/leadin?rate=5#postform">Review us</a>
482
+ </p>
483
  <p class="sharing"><a href="https://twitter.com/leadinapp" class="twitter-follow-button" data-show-count="false">Follow @leadinapp</a>
484
+
485
  <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script></p>
486
  </div>
487
  <!-- begin SnapEngage code -->
frontend/js/leadin.js CHANGED
@@ -12,10 +12,19 @@ jQuery(document).ready( function ( $ ) {
12
  if ( li_submission_cookie )
13
  {
14
  var submission_data = JSON.parse(li_submission_cookie);
15
- leadin_insert_form_submission(submission_data.submission_hash, submission_data.hashkey, submission_data.page_title, submission_data.page_url, submission_data.json_form_fields, submission_data.lead_email, submission_data.form_submission_type, function ( data ) {
16
- // Form was submitted successfully before page reload. Delete cookie for this submission
17
- $.removeCookie('li_submission', {path: "/", domain: ""});
18
- });
 
 
 
 
 
 
 
 
 
19
  }
20
 
21
  if ( !hashkey )
@@ -257,10 +266,19 @@ function leadin_submit_form ( $form, $, form_type )
257
 
258
  $.cookie("li_submission", JSON.stringify(form_submission), {path: "/", domain: ""});
259
 
260
- leadin_insert_form_submission(submission_hash, hashkey, page_title, page_url, json_form_fields, lead_email, form_submission_type, function ( data ) {
261
- // Form was executed 100% successfully before page reload. Delete cookie for this submission
262
- $.removeCookie('li_submission', {path: "/", domain: ""});
263
- });
 
 
 
 
 
 
 
 
 
264
  }
265
  else // No lead - submit form as usual
266
  {
12
  if ( li_submission_cookie )
13
  {
14
  var submission_data = JSON.parse(li_submission_cookie);
15
+ leadin_insert_form_submission(
16
+ submission_data.submission_hash,
17
+ submission_data.hashkey,
18
+ submission_data.page_title,
19
+ submission_data.page_url,
20
+ submission_data.json_form_fields,
21
+ submission_data.lead_email,
22
+ submission_data.form_submission_type,
23
+ function ( data ) {
24
+ // Form was submitted successfully before page reload. Delete cookie for this submission
25
+ $.removeCookie('li_submission', {path: "/", domain: ""});
26
+ }
27
+ );
28
  }
29
 
30
  if ( !hashkey )
266
 
267
  $.cookie("li_submission", JSON.stringify(form_submission), {path: "/", domain: ""});
268
 
269
+ leadin_insert_form_submission(
270
+ submission_hash,
271
+ hashkey,
272
+ page_title,
273
+ page_url,
274
+ json_form_fields,
275
+ lead_email,
276
+ form_submission_type,
277
+ function ( data ) {
278
+ // Form was executed 100% successfully before page reload. Delete cookie for this submission
279
+ $.removeCookie('li_submission', {path: "/", domain: ""});
280
+ }
281
+ );
282
  }
283
  else // No lead - submit form as usual
284
  {
inc/class-leadin-options.php DELETED
@@ -1,149 +0,0 @@
1
- <?php
2
-
3
- class LeadInOptions {
4
-
5
- /*public static function get_option_names( $type = 'compact' ) {
6
- switch ( $type ) {
7
- case 'non-compact' :
8
- case 'non_compact' :
9
- return array(
10
- 'register',
11
- 'activated',
12
- 'active_modules',
13
- 'do_activate',
14
- 'log',
15
- 'publicize',
16
- 'widget_twitter',
17
- 'wpcc_options',
18
- );
19
- }
20
-
21
- return array(
22
- 'id', // (int) The Client ID/WP.com Blog ID of this site.
23
- 'blog_token', // (string) The Client Secret/Blog Token of this site.
24
- 'user_token', // (string) The User Token of this site. (deprecated)
25
- 'publicize_connections', // (array) An array of Publicize connections from WordPress.com
26
- 'master_user', // (int) The local User ID of the user who connected this site to jetpack.wordpress.com.
27
- 'user_tokens', // (array) User Tokens for each user of this site who has connected to jetpack.wordpress.com.
28
- 'version', // (string) Used during upgrade procedure to auto-activate new modules. version:time
29
- 'old_version', // (string) Used to determine which modules are the most recently added. previous_version:time
30
- 'fallback_no_verify_ssl_certs', // (int) Flag for determining if this host must skip SSL Certificate verification due to misconfigured SSL.
31
- 'time_diff', // (int) Offset between Jetpack server's clocks and this server's clocks. Jetpack Server Time = time() + (int) Jetpack_Options::get_option( 'time_diff' )
32
- 'public', // (int|bool) If we think this site is public or not (1, 0), false if we haven't yet tried to figure it out.
33
- 'videopress', // (array) VideoPress options array.
34
- 'is_network_site', // (int|bool) If we think this site is a network or a single blog (1, 0), false if we haven't yet tried to figue it out.
35
- 'social_links', // (array) The specified links for each social networking site.
36
- 'identity_crisis_whitelist', // (array) An array of options, each having an array of the values whitelisted for it.
37
- 'gplus_authors', // (array) The Google+ authorship information for connected users.
38
- 'last_heartbeat', // (int) The timestamp of the last heartbeat that fired.
39
- );
40
- }*/
41
-
42
- /**
43
- * Returns the requested option. Looks in jetpack_options or jetpack_$name as appropriate.
44
- *
45
- * @param string $name Option name
46
- * @param mixed $default (optional)
47
- */
48
- public static function get_option( $name, $default = false ) {
49
- if ( in_array( $name, self::get_option_names( 'non_compact' ) ) ) {
50
- return get_option( "jetpack_$name" );
51
- } else if ( !in_array( $name, self::get_option_names() ) ) {
52
- trigger_error( sprintf( 'Invalid Jetpack option name: %s', $name ), E_USER_WARNING );
53
- return false;
54
- }
55
-
56
- $options = get_option( 'jetpack_options' );
57
- if ( is_array( $options ) && isset( $options[$name] ) ) {
58
- return $options[$name];
59
- }
60
-
61
- return $default;
62
- }
63
-
64
- /**
65
- * Updates the single given option. Updates jetpack_options or jetpack_$name as appropriate.
66
- *
67
- * @param string $name Option name
68
- * @param mixed $value Option value
69
- */
70
- public static function update_option( $name, $value ) {
71
- if ( in_array( $name, self::get_option_names( 'non_compact' ) ) ) {
72
- return update_option( "jetpack_$name", $value );
73
- } else if ( !in_array( $name, self::get_option_names() ) ) {
74
- trigger_error( sprintf( 'Invalid Jetpack option name: %s', $name ), E_USER_WARNING );
75
- return false;
76
- }
77
-
78
- $options = get_option( 'jetpack_options' );
79
- if ( !is_array( $options ) ) {
80
- $options = array();
81
- }
82
-
83
- $options[$name] = $value;
84
-
85
- return update_option( 'jetpack_options', $options );
86
- }
87
-
88
- /**
89
- * Updates the multiple given options. Updates jetpack_options and/or jetpack_$name as appropriate.
90
- *
91
- * @param array $array array( option name => option value, ... )
92
- */
93
- public static function update_options( $array ) {
94
- $names = array_keys( $array );
95
-
96
- foreach ( array_diff( $names, self::get_option_names(), self::get_option_names( 'non_compact' ) ) as $unknown_name ) {
97
- trigger_error( sprintf( 'Invalid Jetpack option name: %s', $unknown_name ), E_USER_WARNING );
98
- unset( $array[$unknown_name] );
99
- }
100
-
101
- foreach ( array_intersect( $names, self::get_option_names( 'non_compact' ) ) as $name ) {
102
- update_option( "jetpack_$name", $array[$name] );
103
- unset( $array[$name] );
104
- }
105
-
106
- $options = get_option( 'jetpack_options' );
107
- if ( !is_array( $options ) ) {
108
- $options = array();
109
- }
110
-
111
- return update_option( 'jetpack_options', array_merge( $options, $array ) );
112
- }
113
-
114
- /**
115
- * Deletes the given option. May be passed multiple option names as an array.
116
- * Updates jetpack_options and/or deletes jetpack_$name as appropriate.
117
- *
118
- * @param string|array $names
119
- */
120
- public static function delete_option( $names ) {
121
- $names = (array) $names;
122
-
123
- foreach ( array_diff( $names, self::get_option_names(), self::get_option_names( 'non_compact' ) ) as $unknown_name ) {
124
- trigger_error( sprintf( 'Invalid Jetpack option name: %s', $unknown_name ), E_USER_WARNING );
125
- }
126
-
127
- foreach ( array_intersect( $names, self::get_option_names( 'non_compact' ) ) as $name ) {
128
- delete_option( "jetpack_$name" );
129
- }
130
-
131
- $options = get_option( 'jetpack_options' );
132
- if ( !is_array( $options ) ) {
133
- $options = array();
134
- }
135
-
136
- $to_delete = array_intersect( $names, self::get_option_names(), array_keys( $options ) );
137
- if ( $to_delete ) {
138
- foreach ( $to_delete as $name ) {
139
- unset( $options[$name] );
140
- }
141
-
142
- return update_option( 'jetpack_options', $options );
143
- }
144
-
145
- return true;
146
- }
147
-
148
- }
149
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/leadin-ajax-functions.php CHANGED
@@ -20,7 +20,7 @@ function leadin_check_merged_contact ()
20
  $q = $wpdb->prepare("SELECT hashkey, merged_hashkeys FROM li_leads WHERE merged_hashkeys LIKE '%%%s%%'", like_escape($stale_hash));
21
  $row = $wpdb->get_row($q);
22
 
23
- if ( isset($row->hashkey) )
24
  {
25
  // One final update to set all the previous pageviews to the new hashkey
26
  $q = $wpdb->prepare("UPDATE li_pageviews SET lead_hashkey = %s WHERE lead_hashkey = %s", $row->hashkey, $stale_hash);
@@ -31,10 +31,12 @@ function leadin_check_merged_contact ()
31
  $wpdb->query($q);
32
 
33
  // Remove the passed hash from the merged hashkeys for the row
34
- $merged_hashkeys = explode(',', $row->merged_hashkeys);
35
- $merged_hashkeys = leadin_array_delete($merged_hashkeys, "'" . $stale_hash . "'");
36
 
37
- $q = $wpdb->prepare("UPDATE li_leads SET merged_hashkeys = %s WHERE hashkey = %s", implode(',', $merged_hashkeys), $row->hashkey);
 
 
 
38
  $wpdb->query($q);
39
 
40
  $q = $wpdb->prepare("DELETE FROM li_leads WHERE hashkey LIKE '%%%s%%'", like_escape($stale_hash));
@@ -144,6 +146,7 @@ function leadin_insert_form_submission ()
144
 
145
  if ( $submission_hash_exists )
146
  {
 
147
  return 1;
148
  exit;
149
  }
@@ -151,6 +154,7 @@ function leadin_insert_form_submission ()
151
  // Don't send the lead email when an administrator is leaving a comment or when the commenter's email is the same as the leadin email
152
  if ( !(current_user_can('administrator') && $submission_type == 'comment') && !(strstr($li_admin_email, $email) && $submission_type == 'comment') )
153
  {
 
154
  $q = $wpdb->prepare("SELECT * FROM li_leads WHERE hashkey = %s", $hashkey);
155
  $contact = $wpdb->get_row($q);
156
 
@@ -158,11 +162,12 @@ function leadin_insert_form_submission ()
158
  $q = $wpdb->prepare("SELECT lead_email, hashkey, merged_hashkeys, lead_status FROM li_leads WHERE lead_email = %s AND hashkey != %s", $email, $hashkey);
159
  $existing_contacts = $wpdb->get_results($q);
160
 
 
161
  $existing_contact_status = 'lead';
162
 
163
  // Setup the string for the existing hashkeys
164
  $existing_contact_hashkeys = $contact->merged_hashkeys;
165
- if ( $contact->merged_hashkeys )
166
  $existing_contact_hashkeys .= ',';
167
 
168
  // Do some merging if the email exists already in the contact table
@@ -173,9 +178,11 @@ function leadin_insert_form_submission ()
173
  // Start with the existing contact's hashkeys and create a string containg comma-deliminated hashes
174
  $existing_contact_hashkeys .= "'" . $existing_contacts[$i]->hashkey . "'";
175
 
 
176
  if ( $existing_contacts[$i]->merged_hashkeys )
177
  $existing_contact_hashkeys .= "," . $existing_contacts[$i]->merged_hashkeys;
178
 
 
179
  if ( $i != count($existing_contacts)-1 )
180
  $existing_contact_hashkeys .= ",";
181
 
@@ -188,6 +195,12 @@ function leadin_insert_form_submission ()
188
  $existing_contact_status = 'subscribe';
189
  }
190
 
 
 
 
 
 
 
191
  // Update all the previous pageviews to the new hashkey
192
  $q = $wpdb->prepare("UPDATE li_pageviews SET lead_hashkey = %s WHERE lead_hashkey IN ( $existing_contact_hashkeys )", $hashkey);
193
  $wpdb->query($q);
@@ -197,7 +210,7 @@ function leadin_insert_form_submission ()
197
  $wpdb->query($q);
198
  }
199
 
200
- // Prevent duplicates by deleting existing submission if it didn't finish the process before the web page refreshed
201
  $q = $wpdb->prepare("DELETE FROM li_submissions WHERE form_hashkey = %s", $submission_hash);
202
  $wpdb->query($q);
203
 
@@ -205,12 +218,12 @@ function leadin_insert_form_submission ()
205
  $result = $wpdb->insert(
206
  'li_submissions',
207
  array(
208
- 'form_hashkey' => $submission_hash,
209
- 'lead_hashkey' => $hashkey,
210
- 'form_page_title' => $page_title,
211
- 'form_page_url' => $page_url,
212
- 'form_fields' => $form_json,
213
- 'form_type' => $submission_type
214
  ),
215
  array(
216
  '%s', '%s', '%s', '%s', '%s', '%s'
20
  $q = $wpdb->prepare("SELECT hashkey, merged_hashkeys FROM li_leads WHERE merged_hashkeys LIKE '%%%s%%'", like_escape($stale_hash));
21
  $row = $wpdb->get_row($q);
22
 
23
+ if ( isset($row->hashkey) && $stale_hash )
24
  {
25
  // One final update to set all the previous pageviews to the new hashkey
26
  $q = $wpdb->prepare("UPDATE li_pageviews SET lead_hashkey = %s WHERE lead_hashkey = %s", $row->hashkey, $stale_hash);
31
  $wpdb->query($q);
32
 
33
  // Remove the passed hash from the merged hashkeys for the row
34
+ $merged_hashkeys = array_unique(array_filter(explode(',', $row->merged_hashkeys)));
 
35
 
36
+ // Delete the stale hash from the merged hashkeys array
37
+ $merged_hashkeys = leadin_array_delete($merged_hashkeys, "'" . $stale_hash . "'");
38
+
39
+ $q = $wpdb->prepare("UPDATE li_leads SET merged_hashkeys = %s WHERE hashkey = %s", rtrim(implode(',', $merged_hashkeys), ','), $row->hashkey);
40
  $wpdb->query($q);
41
 
42
  $q = $wpdb->prepare("DELETE FROM li_leads WHERE hashkey LIKE '%%%s%%'", like_escape($stale_hash));
146
 
147
  if ( $submission_hash_exists )
148
  {
149
+ // The form has been inserted successful so send back a trigger to clear the cache cooke on the front end
150
  return 1;
151
  exit;
152
  }
154
  // Don't send the lead email when an administrator is leaving a comment or when the commenter's email is the same as the leadin email
155
  if ( !(current_user_can('administrator') && $submission_type == 'comment') && !(strstr($li_admin_email, $email) && $submission_type == 'comment') )
156
  {
157
+ // Get the contact row tied to hashkey
158
  $q = $wpdb->prepare("SELECT * FROM li_leads WHERE hashkey = %s", $hashkey);
159
  $contact = $wpdb->get_row($q);
160
 
162
  $q = $wpdb->prepare("SELECT lead_email, hashkey, merged_hashkeys, lead_status FROM li_leads WHERE lead_email = %s AND hashkey != %s", $email, $hashkey);
163
  $existing_contacts = $wpdb->get_results($q);
164
 
165
+ // Set the default contact life cycle status to lead
166
  $existing_contact_status = 'lead';
167
 
168
  // Setup the string for the existing hashkeys
169
  $existing_contact_hashkeys = $contact->merged_hashkeys;
170
+ if ( $contact->merged_hashkeys && count($existing_contacts) )
171
  $existing_contact_hashkeys .= ',';
172
 
173
  // Do some merging if the email exists already in the contact table
178
  // Start with the existing contact's hashkeys and create a string containg comma-deliminated hashes
179
  $existing_contact_hashkeys .= "'" . $existing_contacts[$i]->hashkey . "'";
180
 
181
+ // Add any of those existing contact row's merged hashkeys
182
  if ( $existing_contacts[$i]->merged_hashkeys )
183
  $existing_contact_hashkeys .= "," . $existing_contacts[$i]->merged_hashkeys;
184
 
185
+ // Add a comma delimiter
186
  if ( $i != count($existing_contacts)-1 )
187
  $existing_contact_hashkeys .= ",";
188
 
195
  $existing_contact_status = 'subscribe';
196
  }
197
 
198
+ // Remove duplicates from the array
199
+ $existing_contact_hashkeys = implode(',', array_unique(explode(',', $existing_contact_hashkeys)));
200
+
201
+ // Safety precaution - trim any trailing commas
202
+ $existing_contact_hashkeys = rtrim($existing_contact_hashkeys, ',');
203
+
204
  // Update all the previous pageviews to the new hashkey
205
  $q = $wpdb->prepare("UPDATE li_pageviews SET lead_hashkey = %s WHERE lead_hashkey IN ( $existing_contact_hashkeys )", $hashkey);
206
  $wpdb->query($q);
210
  $wpdb->query($q);
211
  }
212
 
213
+ // Prevent duplicate form submission entries by deleting existing submissions if it didn't finish the process before the web page refreshed
214
  $q = $wpdb->prepare("DELETE FROM li_submissions WHERE form_hashkey = %s", $submission_hash);
215
  $wpdb->query($q);
216
 
218
  $result = $wpdb->insert(
219
  'li_submissions',
220
  array(
221
+ 'form_hashkey' => $submission_hash,
222
+ 'lead_hashkey' => $hashkey,
223
+ 'form_page_title' => $page_title,
224
+ 'form_page_url' => $page_url,
225
+ 'form_fields' => $form_json,
226
+ 'form_type' => $submission_type
227
  ),
228
  array(
229
  '%s', '%s', '%s', '%s', '%s', '%s'
inc/leadin-functions.php CHANGED
@@ -247,4 +247,54 @@ function leadin_get_value_by_key ( $key_value, $array )
247
 
248
  return null;
249
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
250
  ?>
247
 
248
  return null;
249
  }
250
+
251
+ /**
252
+ * Data recovery algorithm for 0.7.2 upgrade
253
+ *
254
+ */
255
+ function leadin_recover_contact_data ()
256
+ {
257
+ global $wpdb;
258
+
259
+ $q = $wpdb->prepare("SELECT * FROM li_submissions WHERE form_fields LIKE '%%%s%%' AND form_fields LIKE '%%%s%%'", '@', '.');
260
+ $submissions = $wpdb->get_results($q);
261
+
262
+ if ( count($submissions) )
263
+ {
264
+ foreach ( $submissions as $submission )
265
+ {
266
+ $json = json_decode(stripslashes($submission->form_fields), TRUE);
267
+
268
+ foreach ( $json as $object )
269
+ {
270
+ if ( strstr($object['value'], '@') && strstr($object['value'], '@') && strlen($object['value']) <= 254 )
271
+ {
272
+ // check to see if the contact exists and if it does, skip the data recovery
273
+ $q = $wpdb->prepare("SELECT lead_email FROM li_leads WHERE lead_email = %s", $object['value']);
274
+ $exists = $wpdb->get_var($q);
275
+
276
+ if ( $exists )
277
+ continue;
278
+
279
+ // get the original data
280
+ $q = $wpdb->prepare("SELECT pageview_date, pageview_source FROM li_pageviews WHERE lead_hashkey = %s ORDER BY pageview_date ASC LIMIT 1", $submission->lead_hashkey);
281
+ $first_pageview = $wpdb->get_row($q);
282
+
283
+ // recreate the contact
284
+ $q = $wpdb->prepare("INSERT INTO li_leads ( lead_date, hashkey, lead_source, lead_email, lead_status ) VALUES ( %s, %s, %s, %s, %s )",
285
+ ( $first_pageview->pageview_date ? $first_pageview->pageview_date : $submission->form_date),
286
+ $submission->lead_hashkey,
287
+ ( $first_pageview->pageview_source ? $first_pageview->pageview_source : ''),
288
+ $object['value'],
289
+ $submission->form_type
290
+ );
291
+
292
+ $wpdb->query($q);
293
+ }
294
+ }
295
+ }
296
+ }
297
+
298
+ leadin_update_option('leadin_options', 'data_recovered', 1);
299
+ }
300
  ?>
leadin.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: LeadIn
4
  Plugin URI: http://leadin.com
5
  Description: LeadIn is an easy-to-use marketing automation and lead tracking plugin for WordPress that helps you better understand your web site visitors.
6
- Version: 0.7.0
7
  Author: Andy Cook, Nelson Joyce
8
  Author URI: http://leadin.com
9
  License: GPL2
@@ -26,7 +26,7 @@ if ( !defined('LEADIN_DB_VERSION') )
26
  define('LEADIN_DB_VERSION', '0.6.2');
27
 
28
  if ( !defined('LEADIN_PLUGIN_VERSION') )
29
- define('LEADIN_PLUGIN_VERSION', '0.7.0');
30
 
31
  if ( !defined('MIXPANEL_PROJECT_TOKEN') )
32
  define('MIXPANEL_PROJECT_TOKEN', 'a9615503ec58a6bce2c646a58390eac1');
@@ -88,11 +88,12 @@ class WPLeadIn {
88
  if ( ($li_options['li_installed'] != 1) || (!is_array($li_options)) )
89
  {
90
  $opt = array(
91
- 'li_installed' => 1,
92
- 'li_db_version' => LEADIN_DB_VERSION,
93
- 'li_email' => get_bloginfo('admin_email'),
94
  'onboarding_complete' => 0,
95
- 'ignore_settings_popup' => 0
 
96
  );
97
 
98
  update_option('leadin_options', $opt);
@@ -218,6 +219,12 @@ class WPLeadIn {
218
  update_option('leadin_active_power_ups', serialize($auto_activate));
219
  }
220
 
 
 
 
 
 
 
221
  // Set the database version if it doesn't exist
222
  if ( isset($li_options['li_db_version']) )
223
  {
@@ -399,7 +406,7 @@ class WPLeadIn {
399
  /**
400
  * Check whether or not a LeadIn power-up is active.
401
  *
402
- * @param string $power_up The slug of a Jetpack module.
403
  * @return bool
404
  *
405
  * @static
3
  Plugin Name: LeadIn
4
  Plugin URI: http://leadin.com
5
  Description: LeadIn is an easy-to-use marketing automation and lead tracking plugin for WordPress that helps you better understand your web site visitors.
6
+ Version: 0.7.2
7
  Author: Andy Cook, Nelson Joyce
8
  Author URI: http://leadin.com
9
  License: GPL2
26
  define('LEADIN_DB_VERSION', '0.6.2');
27
 
28
  if ( !defined('LEADIN_PLUGIN_VERSION') )
29
+ define('LEADIN_PLUGIN_VERSION', '0.7.2');
30
 
31
  if ( !defined('MIXPANEL_PROJECT_TOKEN') )
32
  define('MIXPANEL_PROJECT_TOKEN', 'a9615503ec58a6bce2c646a58390eac1');
88
  if ( ($li_options['li_installed'] != 1) || (!is_array($li_options)) )
89
  {
90
  $opt = array(
91
+ 'li_installed' => 1,
92
+ 'li_db_version' => LEADIN_DB_VERSION,
93
+ 'li_email' => get_bloginfo('admin_email'),
94
  'onboarding_complete' => 0,
95
+ 'ignore_settings_popup' => 0,
96
+ 'data_recovered' => 1
97
  );
98
 
99
  update_option('leadin_options', $opt);
219
  update_option('leadin_active_power_ups', serialize($auto_activate));
220
  }
221
 
222
+ // 0.7.2 bug fix - data recovery algorithm for deleted contacts
223
+ if ( ! isset($li_options['data_recovered']) )
224
+ {
225
+ leadin_recover_contact_data();
226
+ }
227
+
228
  // Set the database version if it doesn't exist
229
  if ( isset($li_options['li_db_version']) )
230
  {
406
  /**
407
  * Check whether or not a LeadIn power-up is active.
408
  *
409
+ * @param string $power_up The slug of a power-up
410
  * @return bool
411
  *
412
  * @static
power-ups/subscribe-widget.php CHANGED
@@ -128,9 +128,11 @@ class WPLeadInSubscribe extends WPLeadIn {
128
  wp_enqueue_script('vex-dialog');
129
 
130
  wp_register_style('leadin-subscribe-vex-css', LEADIN_SUBSCRIBE_WIDGET_PATH . '/frontend/css/vex.css');
131
-
132
  wp_enqueue_style('leadin-subscribe-vex-css');
133
 
 
 
 
134
  //wp_localize_script('leadin', 'li_ajax', array('ajax_url' => admin_url('admin-ajax.php')));
135
  }
136
  }
128
  wp_enqueue_script('vex-dialog');
129
 
130
  wp_register_style('leadin-subscribe-vex-css', LEADIN_SUBSCRIBE_WIDGET_PATH . '/frontend/css/vex.css');
 
131
  wp_enqueue_style('leadin-subscribe-vex-css');
132
 
133
+ wp_register_style('leadin-subscribe', LEADIN_SUBSCRIBE_WIDGET_PATH . '/frontend/css/leadin-subscribe.css');
134
+ wp_enqueue_style('leadin-subscribe');
135
+
136
  //wp_localize_script('leadin', 'li_ajax', array('ajax_url' => admin_url('admin-ajax.php')));
137
  }
138
  }
power-ups/subscribe-widget/frontend/css/leadin-subscribe.css DELETED
@@ -1,47 +0,0 @@
1
- .leadin-subscribe .vex-dialog-message{
2
- font-weight: bold;
3
- margin-bottom: 15px !important;
4
- font-size: 18px !important;
5
- }
6
-
7
- .leadin-subscribe .vex-dialog-button{
8
- background: #444444 !important;
9
- margin-top: -10px !important;
10
- }
11
-
12
- .leadin-subscribe .vex-dialog-input input{
13
- margin-bottom: 10px !important;
14
- font-size: 18px !important;
15
- }
16
-
17
- .leadin-subscribe .vex-dialog-buttons input{
18
- font-size: 14px !important;
19
- color: #fff !important;
20
- }
21
-
22
- .leadin-subscribe .vex-close{
23
- top: 5px !important;
24
- right: 5px !important;
25
- }
26
-
27
- #leadin-subscribe-powered-by{
28
- clear: both;
29
- float: right;
30
- font-size: 12px;
31
- padding-top: 15px;
32
- text-decoration: none;
33
- font-weight: bold;
34
- color: #3288e6;
35
- }
36
-
37
- #leadin-subscribe-powered-by:hover{
38
- text-decoration: underline;
39
- }
40
-
41
- .leadin-subscribe .vex-content{
42
- padding: 15px 15px 10px 15px !important;
43
- }
44
-
45
- @media only screen and (max-width: 760px) {
46
- #leadin-subscribe-mobile-check { display: none; }
47
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: andygcook, nelsonjoyce
3
  Tags: lead tracking, visitor tracking, analytics, crm, marketing automation, inbound marketing, subscription, marketing, lead generation, mailchimp
4
  Requires at least: 3.7
5
  Tested up to: 3.8.2
6
- Stable tag: 0.7.0
7
 
8
  LeadIn is an easy-to-use marketing automation and lead tracking plugin for WordPress that helps you better understand your web site visitors.
9
 
@@ -88,14 +88,25 @@ To ensure quality we've tested the most popular WordPress form builder plugins.
88
 
89
  == Changelog ==
90
 
91
- Current version: 0.7.0
92
- Current version release: 2014-04-10
 
 
 
 
 
 
 
 
 
 
 
93
 
94
  = 0.7.0 (2014.04.10) =
95
 
96
  = Enhancements =
97
  - MailChimp List Sync power-up
98
- - Added new themes (bottom right, bottom left, top and pop-up) to the WordPerss Subscribe Widget power-up
99
 
100
  = 0.6.2 (2014.04.07) =
101
  - Bug fixes
3
  Tags: lead tracking, visitor tracking, analytics, crm, marketing automation, inbound marketing, subscription, marketing, lead generation, mailchimp
4
  Requires at least: 3.7
5
  Tested up to: 3.8.2
6
+ Stable tag: 0.7.2
7
 
8
  LeadIn is an easy-to-use marketing automation and lead tracking plugin for WordPress that helps you better understand your web site visitors.
9
 
88
 
89
  == Changelog ==
90
 
91
+ Current version: 0.7.2
92
+ Current version release: 2014-04-18
93
+
94
+ = 0.7.2 (2014.04.18) =
95
+ -Bug fixes
96
+ - Fix contact deletion bug
97
+ - Implement data recovery fix for contacts
98
+ - Bug fixes to contact merging
99
+
100
+
101
+ = 0.7.1 (2014.04.11) =
102
+ -Bug fixes
103
+ - SVN bug fix that did not add the MailChimp List sync power-up
104
 
105
  = 0.7.0 (2014.04.10) =
106
 
107
  = Enhancements =
108
  - MailChimp List Sync power-up
109
+ - Added new themes (bottom right, bottom left, top and pop-up) to the WordPress Subscribe Widget power-up
110
 
111
  = 0.6.2 (2014.04.07) =
112
  - Bug fixes