Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/14/2009 06:27:34 PM (17 years ago)
Author:
apeatling
Message:

Added field_order support for new profile fields created.

File:
1 edited

Legend:

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

    r1830 r1868  
    250250                $this->is_required = apply_filters( 'xprofile_field_is_required_before_save', $this->is_required, $this->id );
    251251                $this->order_by = apply_filters( 'xprofile_field_order_by_before_save', $this->order_by, $this->id );
     252                $this->field_order = apply_filters( 'xprofile_field_field_order_before_save', $this->field_order, $this->id );
    252253
    253254                do_action( 'xprofile_field_before_save', $this );
    254255               
    255256                if ( $this->id != null )
    256                         $sql = $wpdb->prepare("UPDATE {$bp->profile->table_name_fields} SET group_id = %d, parent_id = 0, type = %s, name = %s, description = %s, is_required = %d, order_by = %s WHERE id = %d", $this->group_id, $this->type, $this->name, $this->desc, $this->is_required, $this->order_by, $this->id);
     257                        $sql = $wpdb->prepare("UPDATE {$bp->profile->table_name_fields} SET group_id = %d, parent_id = 0, type = %s, name = %s, description = %s, is_required = %d, order_by = %s, field_order = %d WHERE id = %d", $this->group_id, $this->type, $this->name, $this->desc, $this->is_required, $this->order_by, $this->field_order, $this->id);
    257258                else
    258                         $sql = $wpdb->prepare("INSERT INTO {$bp->profile->table_name_fields} (group_id, parent_id, type, name, description, is_required, order_by) VALUES (%d, 0, %s, %s, %s, %d, %d)", $this->group_id, $this->type, $this->name, $this->desc, $this->is_required, $this->order_by);
     259                        $sql = $wpdb->prepare("INSERT INTO {$bp->profile->table_name_fields} (group_id, parent_id, type, name, description, is_required, order_by, field_order ) VALUES (%d, 0, %s, %s, %s, %d, %s, %d )", $this->group_id, $this->type, $this->name, $this->desc, $this->is_required, $this->order_by, $this->field_order );
    259260
    260261                if ( $wpdb->query($sql) ) {
     
    566567        }
    567568       
    568         /* Deprecated - Signup fields are now in the template */
    569         function get_signup_fields() {
    570                 global $wpdb, $bp;
    571                
    572                 $sql = $wpdb->prepare( "SELECT f.id FROM {$bp->profile->table_name_fields} AS f, {$bp->profile->table_name_groups} AS g WHERE g.name = %s AND f.parent_id = 0   AND g.id = f.group_id ORDER BY f.id", get_site_option('bp-xprofile-base-group-name') );
    573 
    574                 if ( !$temp_fields = $wpdb->get_results($sql) )
    575                         return false;
    576                
    577                 for ( $i = 0; $i < count($temp_fields); $i++ ) {
    578                         $fields[] = new BP_XProfile_Field( $temp_fields[$i]->id, null, false );
    579                 }
    580                
    581                 return $fields;
    582         }
    583        
    584         /* Deprecated, Validation is now done in the screen function */
    585569        function admin_validate() {
    586570                global $message;
     
    606590                }
    607591        }
     592
     593        /* Deprecated - Signup fields are now in the template */
     594        function get_signup_fields() {
     595                global $wpdb, $bp;
     596               
     597                $sql = $wpdb->prepare( "SELECT f.id FROM {$bp->profile->table_name_fields} AS f, {$bp->profile->table_name_groups} AS g WHERE g.name = %s AND f.parent_id = 0   AND g.id = f.group_id ORDER BY f.id", get_site_option('bp-xprofile-base-group-name') );
     598
     599                if ( !$temp_fields = $wpdb->get_results($sql) )
     600                        return false;
     601               
     602                for ( $i = 0; $i < count($temp_fields); $i++ ) {
     603                        $fields[] = new BP_XProfile_Field( $temp_fields[$i]->id, null, false );
     604                }
     605               
     606                return $fields;
     607        }
     608
    608609}
    609610
Note: See TracChangeset for help on using the changeset viewer.