Plugin Directory

Changeset 534578


Ignore:
Timestamp:
04/21/2012 10:19:39 PM (14 years ago)
Author:
froman118
Message:
 
Location:
my-category-order/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • my-category-order/trunk/mycategoryorder.php

    r519203 r534578  
    44Plugin URI: http://www.geekyweekly.com/mycategoryorder
    55Description: My Category Order allows you to set the order in which categories will appear in the sidebar. Uses a drag and drop interface for ordering. Adds a widget with additional options for easy installation on widgetized themes.
    6 Version: 3.3.1
     6Version: 3.3.2
    77Author: Andrew Charlton
    88Author URI: http://www.geekyweekly.com
     
    7070
    7171    if (isset($_POST['btnReturnParent'])) {
    72         $parentsParent = $wpdb->get_row("SELECT parent FROM $wpdb->term_taxonomy WHERE term_id = " . $_POST['hdnParentID'], ARRAY_N);
     72        $parentsParent = $wpdb->get_row($wpdb->prepare("SELECT parent FROM $wpdb->term_taxonomy WHERE term_id = %d ", $_POST['hdnParentID']) , ARRAY_N);
    7373        $parentID = $parentsParent[0];
    7474    }
    7575       
    76     if(isset($_GET['hideNote']))
    77         update_option('mycategoryorder_hideNote', '1');
    78 
    7976    $success = "";
    8077    if (isset($_POST['btnOrderCats'])) {
     
    8986        <h2><?php _e('My Category Order','mycategoryorder'); ?></h2>
    9087    <?php
    91    
    92     echo $success;
    93    
    94     if (get_option("mycategoryorder_hideNote") != "1")
    95         {   ?>
    96             <div class="updated">
    97                 <strong><p><?php _e('If you like my plugin please consider donating. Every little bit helps me provide support and continue development.','mycategoryorder'); ?> <a href="http://geekyweekly.com/gifts-and-donations"><?php _e('Donate', 'mycategoryorder'); ?></a>&nbsp;&nbsp;<small><a href="<?php echo mycategoryorder_getTarget(); ?>&hideNote=true"><?php _e('No thanks, hide this', 'mycategoryorder'); ?></a></small></p></strong>
    98             </div>
    99         <?php
    100         }?>
     88        echo $success;
     89    ?>
    10190
    10291    <p><?php _e('Choose a category from the drop down to order subcategories in that category or order the categories on this level by dragging and dropping them into the desired order.','mycategoryorder'); ?></p>
     
    201190   
    202191    $subCatStr = "";
    203     $results=$wpdb->get_results("SELECT t.term_id, t.name FROM $wpdb->term_taxonomy tt, $wpdb->terms t, $wpdb->term_taxonomy tt2 WHERE tt.parent = $parentID AND tt.taxonomy = 'category' AND t.term_id = tt.term_id AND tt2.parent = tt.term_id GROUP BY t.term_id, t.name HAVING COUNT(*) > 0 ORDER BY t.term_order ASC");
     192    $results=$wpdb->get_results($wpdb->prepare("SELECT t.term_id, t.name FROM $wpdb->term_taxonomy tt, $wpdb->terms t, $wpdb->term_taxonomy tt2 WHERE tt.parent = %d AND tt.taxonomy = 'category' AND t.term_id = tt.term_id AND tt2.parent = tt.term_id GROUP BY t.term_id, t.name HAVING COUNT(*) > 0 ORDER BY t.term_order ASC", $parentID));
    204193    foreach($results as $row)
    205194    {
     
    222211        {
    223212            $str = str_replace("id_", "", $IDs[$i]);
    224             $wpdb->query("UPDATE $wpdb->terms SET term_order = '$i' WHERE term_id ='$str'");
     213            $wpdb->query($wpdb->prepare("UPDATE $wpdb->terms SET term_order = %d WHERE term_id = %d ", $i, $str));
    225214        }
    226215
     
    234223{
    235224    global $wpdb;
    236     return $wpdb->get_results("SELECT * FROM $wpdb->terms t inner join $wpdb->term_taxonomy tt on t.term_id = tt.term_id WHERE taxonomy = 'category' and parent = $parentID ORDER BY term_order ASC");
     225    return $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->terms t inner join $wpdb->term_taxonomy tt on t.term_id = tt.term_id WHERE taxonomy = 'category' and parent = %d ORDER BY term_order ASC", $parentID));
    237226}
    238227
  • my-category-order/trunk/readme.txt

    r519198 r534578  
    44Tags: categories, category, order, sidebar, widget
    55Requires at least: 2.8
    6 Tested up to: 3.3.1
    7 Stable tag: 3.3.1
     6Tested up to: 3.3.2
     7Stable tag: 3.3.2
    88
    99My Category Order allows you to set the order in which categories will appear in the sidebar.
Note: See TracChangeset for help on using the changeset viewer.