WordPress.org

Plugin Directory

Changeset 464462


Ignore:
Timestamp:
11/18/11 03:20:08 (2 years ago)
Author:
MarcusPope
Message:

two bug fixes - a result of really poor refactoring. Sorry.

Location:
content-molecules/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • content-molecules/trunk/emc2_content_molecules.php

    r461622 r464462  
    3737    //property map for public namespace variables 
    3838    public static $props = array( 
    39         'tag_id' => 'emc2_molecule_tag_identifier', 
    4039        'post_type' => 'emc2_molecule_pt', //cannot be longer than 20 characters... why?! 
    4140        'meta_box' => 'emc2_content_molecules_meta', 
     
    114113     
    115114    static function manage_posts_columns_handler($cols) { 
    116         $cols['slug'] = __('Slug'); 
    117         return array( 
    118             'cb' => '<input type="checkbox" />', 
    119             'title' => 'Title', 
    120             'slug'   => 'Slug', 
    121             'date' => "Date" 
    122         ); 
     115        $sort = array(); 
     116        //Inject slug just before date column 
     117        foreach ($cols as $k => $v) { 
     118            if ($k == "date") { 
     119                $sort['slug'] = __("Slug"); 
     120                $sort['author'] = __("Author"); 
     121            } 
     122            $sort[$k] = $v; 
     123        } 
     124         
     125        return $sort; 
    123126    } 
    124127     
    125128    static function manage_posts_custom_column_handler($col_name) { 
    126         global $post; 
    127129        if ($col_name = "slug") echo $post->post_name; 
    128130    } 
     
    145147     
    146148    static function init_admin() { 
    147          
    148149        //save custom properties on this custom post type 
    149         add_action('save_post', array('EMC2_Molecule', 'save_post_handler'), 10, 2); //pass post_obj to call back 
    150          
    151         $mod_actions = array('deleted_post', 'trashed_post', 'edit_post', 'publish_post', 'publish_future_post'); 
    152         foreach($mod_actions as $action) { 
    153             add_filter($action, array('EMC2_Molecule', 'reset_transient_cache'));    
    154         } 
    155          
    156         //customize columns of molecule list view 
    157         add_filter('manage_posts_columns', array('EMC2_Molecule', 'manage_posts_columns_handler')); 
    158         add_filter('manage_posts_custom_column', array('EMC2_Molecule', 'manage_posts_custom_column_handler')); 
    159         add_filter('manage_edit-emc2_molecule_pt_sortable_columns', array('EMC2_Molecule', 'manage_column_sorting_handler')); 
    160         add_filter("request", array('EMC2_Molecule', 'custom_colum_sort_param_handler')); 
     150        if (@$_GET['post_type'] == EMC2_Molecule::$props['post_type']) { 
     151            add_action('save_post', array('EMC2_Molecule', 'save_post_handler'), 10, 2); //pass post_obj to call back 
     152             
     153            $mod_actions = array('deleted_post', 'trashed_post', 'edit_post', 'publish_post', 'publish_future_post'); 
     154            foreach($mod_actions as $action) { 
     155                add_filter($action, array('EMC2_Molecule', 'reset_transient_cache'));    
     156            } 
     157             
     158            //customize columns of molecule list view 
     159            add_filter('manage_posts_columns', array('EMC2_Molecule', 'manage_posts_columns_handler')); 
     160            add_filter('manage_posts_custom_column', array('EMC2_Molecule', 'manage_posts_custom_column_handler')); 
     161            add_filter('manage_edit-emc2_molecule_pt_sortable_columns', array('EMC2_Molecule', 'manage_column_sorting_handler')); 
     162            add_filter("request", array('EMC2_Molecule', 'custom_colum_sort_param_handler')); 
     163        } 
    161164    } 
    162165 
  • content-molecules/trunk/readme.txt

    r461623 r464462  
    5151== Changelog == 
    5252 
     53= 1.1 = 
     54* Fixed two bugs: potential overwrite of other custom properties added to view all list. 
     55                  loaded molecule specific filters are all custom post types. 
    5356= 1.0 = 
    5457* Initial creation of plugin 
Note: See TracChangeset for help on using the changeset viewer.