Plugin Directory

Changeset 1312190


Ignore:
Timestamp:
12/19/2015 06:12:07 AM (10 years ago)
Author:
trackhs
Message:

1.9.6 fixes

Location:
track-connect/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • track-connect/trunk/includes/api/request.php

    r1311875 r1312190  
    3131        return json_decode($units['body']);
    3232    }
     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    }
    3340       
    3441    public function getUnits($page = 1, $size = 25){
     
    7279            }     
    7380        }*/
     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               
    7487        $unitsRemoved = 0;
    7588        $count = 0;
     
    224237                }
    225238                 
    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 ));
    232242               
    233243                // Update the Amenities
     
    318328               
    319329                //Create the Status   
    320                 $term = $wpdb->get_row("SELECT term_id FROM wp_terms WHERE slug = 'active' LIMIT 1;");
    321330                $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 ));
    324332                   
    325333                // Setup amenities as features
     
    337345            }           
    338346
    339         }
    340        
    341         $this->getUnitNodes();
    342         $this->rebuildTaxonomies();     
     347        }   
    343348       
    344349        return array(
     
    400405        $wpdb->query("UPDATE wp_track_node_types set active = 0");
    401406       
     407        if(isset(json_decode($nodes['body'])->response)){
    402408        foreach(json_decode($nodes['body'])->response as $nodeId => $node){
    403409            $nodeType = $wpdb->get_row("SELECT id FROM wp_track_node_types WHERE type_id = '".$node->typeid."';");
     
    467473           
    468474                   
    469         }   
     475        }
     476        } 
    470477    }
    471478   
  • track-connect/trunk/includes/views/wp-listings-settings.php

    r1311875 r1312190  
    163163            loopArray(pages);
    164164        }else{
    165             $j('#sync-msg').append('<br><br><b>All units have been synced. You can now close this window. </b>');
     165            finalizeSync();       
    166166        }
    167167    });
     
    194194}
    195195
     196function 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
    196209$j(function() {
    197210    $j('#progressbar' ).progressbar({
  • track-connect/trunk/plugin.php

    r1311875 r1312190  
    77    Author URI: http://www.trackhs.com
    88
    9     Version: 1.9.5
     9    Version: 1.9.6
    1010
    1111    License: GNU General Public License v2.0 (or later)
     
    5555
    5656    define( 'WP_LISTINGS_URL', plugin_dir_url( __FILE__ ) );
    57     define( 'WP_LISTINGS_VERSION', '1.9.5' );
     57    define( 'WP_LISTINGS_VERSION', '1.9.6' );
    5858
    5959    /** Load textdomain for translation */
     
    204204    require_once( __DIR__ . '/includes/api/request.php' );
    205205    $request = new plugins\api\pluginApi($options['wp_listings_domain'],$options['wp_listings_token']);
    206     $count =  $request->getUnitCount(); 
     206    $count =  $request->getUnitCount();
     207    $request->removeActive();
    207208   
    208209    wp_send_json( $count );
     210}
     211
     212add_action( 'wp_ajax_sync_other', 'sync_other' );
     213function 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();
    209219}
    210220
  • track-connect/trunk/readme.txt

    r1311875 r1312190  
    44Requires at least: 3.7
    55Tested up to: 4.2.3
    6 Stable tag: 1.9.5
     6Stable tag: 1.9.6
    77
    88Creates 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.