WordPress.org

Ready to get started?Download WordPress

Forums

Basic Google Maps Placemarks
Sortable columns broken (4 posts)

  1. volfro
    Member
    Posted 2 years ago #

    Just a note: column sorting from the admin seems to be broken.

    In order to get some custom (sortable) columns to actually sort properly, I had to comment out lines 115 and 1091-1131 in core.php.

    As it stands, the existing code seems to break even sorting by title. Commenting those lines out fixed the title sorting, even without the code linked above.

    http://wordpress.org/extend/plugins/basic-google-maps-placemarks/

  2. Ian Dunn
    Member
    Plugin Author

    Posted 2 years ago #

    Thanks for letting me know. I'll fix that in an upcoming release, probably v1.8.1.

    What version of the plugin are you using? core.php in version 1.7 only has 1,083 lines, and line 115 is just grabbing an option from the database. If you've modified core.php then your line numbers will probably be different than the original ones. Can you paste the code that you commented out?

  3. volfro
    Member
    Posted 2 years ago #

    V.1.7

    Oh, strange, there's a carriage return between every line. Doubles the length of the file. I've seen this happen to plug-ins and themes before.

    The real line numbers are lines 58:
    add_filter( 'parse_query', array( $this, 'sortAdminView' ) );
    and 546-561:

    /**
    		 * Sorts the posts by the title in the admin view posts screen
    		 * @author Ian Dunn <ian@iandunn.name>
    		 */
    		function sortAdminView( $query )
    		{
    			global $pagenow;
    
    			if( is_admin() && $pagenow == 'edit.php' && array_key_exists( 'post_type', $_GET ) && $_GET[ 'post_type' ] == self::POST_TYPE )
    			{
    				$query->query_vars['order'] = apply_filters( self::PREFIX . 'admin-sort-order', 'ASC' );
    				$query->query_vars['orderby'] = apply_filters( self::PREFIX . 'admin-sort-orderby', 'title' );
    
    				// @todo - should just have a filter on $query, or don't even need one at all, since they can filter $query directly?
    			}
    		}
  4. Ian Dunn
    Member
    Plugin Author

    Posted 2 years ago #

    Yeah, different operating systems use different end-of-line formats, and many text editors don't handle it gracefully.

    Thanks for posting the code, that makes much more sense now. I've added it to my TODO list.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic