Skip to:
Content

BuddyPress.org

Changeset 1870


Ignore:
Timestamp:
09/14/2009 06:38:21 PM (15 years ago)
Author:
apeatling
Message:

Fixes #1002

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-xprofile/bp-xprofile-classes.php

    r1868 r1870  
    8080    function get_fields() {
    8181        global $wpdb, $bp;
     82       
     83        /* Find the max value for field_order, if it is zero, order by field_id instead -- provides backwards compat ordering */
     84        if ( !(int) $wpdb->get_var( $wpdb->prepare( "SELECT MAX(field_order) FROM {$bp->profile->table_name_fields} WHERE group_id = %d", $this->id ) ) )
     85            $order_sql = "ORDER BY id";
     86        else
     87            $order_sql = "ORDER BY field_order";
    8288
    8389        // Get field ids for the current group.
    84         if ( !$fields = $wpdb->get_results( $wpdb->prepare("SELECT id, type FROM {$bp->profile->table_name_fields} WHERE group_id = %d AND parent_id = 0 ORDER BY field_order", $this->id ) ) )
     90        if ( !$fields = $wpdb->get_results( $wpdb->prepare("SELECT id, type FROM {$bp->profile->table_name_fields} WHERE group_id = %d AND parent_id = 0 {$order_sql}", $this->id ) ) )
    8591            return false;
    8692       
Note: See TracChangeset for help on using the changeset viewer.