Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/14/2009 06:27:34 PM (15 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-admin.php

    r1798 r1868  
    209209
    210210function xprofile_admin_manage_field( $group_id, $field_id = null ) {
    211     global $message, $groups;
     211    global $bp, $wpdb, $message, $groups;
    212212   
    213213    $field = new BP_XProfile_Field($field_id);
     
    215215
    216216    if ( isset($_POST['saveField']) ) {
    217         if ( BP_XProfile_Field::admin_validate($_POST) ) {
     217        if ( BP_XProfile_Field::admin_validate() ) {
    218218            $field->name = wp_filter_kses( $_POST['title'] );
    219219            $field->desc = wp_filter_kses( $_POST['description'] );
     
    221221            $field->type = wp_filter_kses( $_POST['fieldtype'] );
    222222            $field->order_by = wp_filter_kses( $_POST["sort_order_$field->type"] );
     223            $field->field_order = (int) $wpdb->get_var( $wpdb->prepare( "SELECT max(field_order) FROM {$bp->profile->table_name_fields} WHERE group_id = %d", $group_id ) );
     224            $field->field_order++;
    223225           
    224226            if ( !$field->save() ) {
Note: See TracChangeset for help on using the changeset viewer.