1
rlankford
Wordpress 2.05 sorting issue.
  • 2008/8/6 13:35

  • rlankford

  • Not too shy to talk

  • Posts: 158

  • Since: 2004/8/27


Xoops, version 2.0.18.1
Wordpress, version 2.0.5

I have the multi-author wordpress for XOOPS module installed. I'd ask this question at XoopsForge, but that site seems to be having issues at the moment (index.php = blank page, submit to forum = blank page, etc.).

Anyway, I've got a site that, as of just a couple of days ago, sorts blogs in ascending by date order. Normally, you'd click on an author's name and see their latest blog followed by older ones all the way back to the beginning. Now, all of the sudden, the reverse it true. The oldest entries show up at the top.

I have no idea what could have done this. I have recently upgraded my Xampp stack.

From:
# Apache HTTPD 2.2.4 + Openssl 0.9.8e
# MySQL 5.0.45
# PHP 5.2.3

To:
# Apache HTTPD 2.2.9 + Openssl 0.9.8h
# MySQL 5.0.51b
# PHP 5.2.6

I can't imagine that making a difference though.

I don't see any options anywhere to control sort order on these pages. I know I'm not crazy, too, since I have another site who's sort order is still correct (newest to oldest). Has anyone seen this before? Does anyone have any ideas on where I would begin looking to alter this??

Thanks so much in advance!

2
rlankford
Re: Wordpress 2.05 sorting issue.
  • 2008/8/12 20:15

  • rlankford

  • Not too shy to talk

  • Posts: 158

  • Since: 2004/8/27


Nobody? Darn. I was really hoping someone had some idea of what might be going on here.

BTW: Love the 'stars' being changed to Xoops' orb symbols!

3
NovaSmart
Re: Wordpress 2.05 sorting issue.
  • 2008/8/13 19:06

  • NovaSmart

  • Module Developer

  • Posts: 158

  • Since: 2007/6/1 2


I don't know if tyhis can solve your problem or not. Try to upgrade to XPRESS 2.11.0 that i update from xoopsforge XPRESS 2.05. There is no guarantee it is bug free, so please try on localhost 1st.

You can get it here :
http://xoops.novasmarttechnology.com/modules/wfdownloads/viewcat.php?cid=2
Malaysia R&D Company (Reg No: 001614159-X)
http://www.NovaSmartTechnology.com

NovaSmart XOOPS Module & Hack Website
http://xoops.NovaSmartTechnology.com

4
rlankford
Re: Wordpress 2.05 sorting issue.
  • 2008/9/12 15:18

  • rlankford

  • Not too shy to talk

  • Posts: 158

  • Since: 2004/8/27


I finally got around to really looking at this problem. Here is the solution (for others that might care):

Version 2.05
Pages Sort Incorrectly

Issue Description
The RSS feeds and the "Posts by Author" pages quit working. Specifically, results were no longer sorting newest to oldest --- but just the opposite. The RSS feed fails because new items never get delivered to the RSS reader. The "Posts by Author" page fails simply because it isn't very usable to have to scroll to the very end to see the most recent posts (which one, presumably, most often wants to see).

Issue Solution
After much poking around in the source code we found that the GROUP BY / ORDER BY implementation changed from one version of MySQL to the next. This caused the issue when a recent Xampp upgrade was performed.

The needed fix was to eliminate the GROUP BY clause from the SQL query completely. This fix may have unintended side effects. For now, however, everything seems to be fine.

~line 654 in wp-includes/classes.php:
/* Changes made by Lankford on 2008/9/12 - see http://idportal/wiki/index.php/WordPress_for_Xoops_Customizations */
// Apply post-paging filters on where and join.  Only plugins that
// manipulate paging queries should use these hooks.
$where apply_filters('posts_where_paged'$where);
$groupby $wpdb->posts.ID ";  
$groupby apply_filters('posts_groupby'$groupby);  
$join apply_filters('posts_join_paged'$join);
$orderby "post_" $q['orderby'];
$orderby apply_filters('posts_orderby'$orderby); 
//$request = " SELECT $distinct * FROM $wpdb->posts $join WHERE 10=10" . $where . " GROUP BY " . $groupby . " ORDER BY " . $orderby . " $limits"; // Removed by Lankford on 2009/9/12 
$request " SELECT $distinct * FROM $wpdb->posts $join WHERE 1=1" $where " ORDER BY " $orderby $limits"// Updated (see line above) by Lankford on 2009/9/12.
$this->request apply_filters('posts_request'$request);
 
$this->posts $wpdb->get_results($this->request);


~line 506 in wp-includes/template-functions-links.php:
if ( !isset($max_num_pages) ) {
    
/* Changes made by Lankford on 2008/9/12 - see http://idportal/wiki/index.php/WordPress_for_Xoops_Customizations */
    //preg_match('#FROMs(.*)sGROUP BY#siU', $request, $matches);  // Removed by Lankford on 2009/9/12 
    
preg_match('#FROMs(.*)sORDER BY#siU'$request$matches); // Altered by Lankford on 2009/9/12.
    
$fromwhere $matches[1];
    
$numposts $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere");
    
$max_num_pages ceil($numposts $posts_per_page);
}

Login

Who's Online

288 user(s) are online (226 user(s) are browsing Support Forums)


Members: 0


Guests: 288


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits