Changeset 1312190
- Timestamp:
- 12/19/2015 06:12:07 AM (10 years ago)
- Location:
- track-connect/trunk
- Files:
-
- 4 edited
-
includes/api/request.php (modified) (7 diffs)
-
includes/views/wp-listings-settings.php (modified) (2 diffs)
-
plugin.php (modified) (3 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
track-connect/trunk/includes/api/request.php
r1311875 r1312190 31 31 return json_decode($units['body']); 32 32 } 33 34 public function removeActive(){ 35 global $wpdb; 36 37 $term = $wpdb->get_row("SELECT term_id FROM wp_terms WHERE slug = 'active' LIMIT 1;"); 38 $wpdb->delete( 'wp_term_relationships', array('term_taxonomy_id' => $term->term_id)); 39 } 33 40 34 41 public function getUnits($page = 1, $size = 25){ … … 72 79 } 73 80 }*/ 81 82 $term = $wpdb->get_row("SELECT term_id FROM wp_terms WHERE slug = 'active' LIMIT 1;"); 83 $wpdb->delete( 'wp_term_relationships', array('term_taxonomy_id' => 0)); 84 $wpdb->delete( 'wp_term_relationships', array('object_id' => 0)); 85 $activeTerm = $term->term_id; 86 74 87 $unitsRemoved = 0; 75 88 $count = 0; … … 224 237 } 225 238 226 // Update the Status 227 $term = $wpdb->get_row("SELECT term_id FROM wp_terms WHERE slug = 'active' LIMIT 1;"); 228 $wpdb->query("DELETE FROM wp_term_relationships WHERE object_id = '".$post_id."' AND term_taxonomy_id = '".$term->term_id."';"); 229 $wpdb->query("INSERT INTO wp_term_relationships set 230 object_id = '".$post_id."', 231 term_taxonomy_id = '".$term->term_id."';"); 239 // Update the Status; 240 $wpdb->insert( 'wp_term_relationships', 241 array( 'object_id' => $post_id, 'term_taxonomy_id' => $activeTerm )); 232 242 233 243 // Update the Amenities … … 318 328 319 329 //Create the Status 320 $term = $wpdb->get_row("SELECT term_id FROM wp_terms WHERE slug = 'active' LIMIT 1;");321 330 $wpdb->insert( 'wp_term_relationships', 322 array( 'object_id' => $post_id, 'term_taxonomy_id' => $term->term_id ), 323 array( '%d', '%d' ) ); 331 array( 'object_id' => $post_id, 'term_taxonomy_id' => $activeTerm )); 324 332 325 333 // Setup amenities as features … … 337 345 } 338 346 339 } 340 341 $this->getUnitNodes(); 342 $this->rebuildTaxonomies(); 347 } 343 348 344 349 return array( … … 400 405 $wpdb->query("UPDATE wp_track_node_types set active = 0"); 401 406 407 if(isset(json_decode($nodes['body'])->response)){ 402 408 foreach(json_decode($nodes['body'])->response as $nodeId => $node){ 403 409 $nodeType = $wpdb->get_row("SELECT id FROM wp_track_node_types WHERE type_id = '".$node->typeid."';"); … … 467 473 468 474 469 } 475 } 476 } 470 477 } 471 478 -
track-connect/trunk/includes/views/wp-listings-settings.php
r1311875 r1312190 163 163 loopArray(pages); 164 164 }else{ 165 $j('#sync-msg').append('<br><br><b>All units have been synced. You can now close this window. </b>');165 finalizeSync(); 166 166 } 167 167 }); … … 194 194 } 195 195 196 function finalizeSync() { 197 $j.ajax('/wp-admin/admin-ajax.php', { 198 type: "POST", 199 dataType: 'json', 200 data: { 201 action: 'sync_other' 202 }, 203 success: function (d) { 204 $j('#sync-msg').append('<br><br><b>All units and locations have been synced. You can now close this window. </b>'); 205 } 206 }); 207 } 208 196 209 $j(function() { 197 210 $j('#progressbar' ).progressbar({ -
track-connect/trunk/plugin.php
r1311875 r1312190 7 7 Author URI: http://www.trackhs.com 8 8 9 Version: 1.9. 59 Version: 1.9.6 10 10 11 11 License: GNU General Public License v2.0 (or later) … … 55 55 56 56 define( 'WP_LISTINGS_URL', plugin_dir_url( __FILE__ ) ); 57 define( 'WP_LISTINGS_VERSION', '1.9. 5' );57 define( 'WP_LISTINGS_VERSION', '1.9.6' ); 58 58 59 59 /** Load textdomain for translation */ … … 204 204 require_once( __DIR__ . '/includes/api/request.php' ); 205 205 $request = new plugins\api\pluginApi($options['wp_listings_domain'],$options['wp_listings_token']); 206 $count = $request->getUnitCount(); 206 $count = $request->getUnitCount(); 207 $request->removeActive(); 207 208 208 209 wp_send_json( $count ); 210 } 211 212 add_action( 'wp_ajax_sync_other', 'sync_other' ); 213 function sync_other(){ 214 $options = get_option('plugin_wp_listings_settings'); 215 require_once( __DIR__ . '/includes/api/request.php' ); 216 $request = new plugins\api\pluginApi($options['wp_listings_domain'],$options['wp_listings_token']); 217 $request->getUnitNodes(); 218 $request->rebuildTaxonomies(); 209 219 } 210 220 -
track-connect/trunk/readme.txt
r1311875 r1312190 4 4 Requires at least: 3.7 5 5 Tested up to: 4.2.3 6 Stable tag: 1.9. 56 Stable tag: 1.9.6 7 7 8 8 Creates and syncs listing-type posts from TRACK PM, a cloud-based property management system (www.trackhs.com).
Note: See TracChangeset
for help on using the changeset viewer.