Changeset 1868
- Timestamp:
- 09/14/2009 06:27:34 PM (16 years ago)
- Location:
- trunk/bp-xprofile
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-xprofile/bp-xprofile-admin.php
r1798 r1868 209 209 210 210 function xprofile_admin_manage_field( $group_id, $field_id = null ) { 211 global $ message, $groups;211 global $bp, $wpdb, $message, $groups; 212 212 213 213 $field = new BP_XProfile_Field($field_id); … … 215 215 216 216 if ( isset($_POST['saveField']) ) { 217 if ( BP_XProfile_Field::admin_validate( $_POST) ) {217 if ( BP_XProfile_Field::admin_validate() ) { 218 218 $field->name = wp_filter_kses( $_POST['title'] ); 219 219 $field->desc = wp_filter_kses( $_POST['description'] ); … … 221 221 $field->type = wp_filter_kses( $_POST['fieldtype'] ); 222 222 $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++; 223 225 224 226 if ( !$field->save() ) { -
trunk/bp-xprofile/bp-xprofile-classes.php
r1830 r1868 250 250 $this->is_required = apply_filters( 'xprofile_field_is_required_before_save', $this->is_required, $this->id ); 251 251 $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 ); 252 253 253 254 do_action( 'xprofile_field_before_save', $this ); 254 255 255 256 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); 257 258 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 ); 259 260 260 261 if ( $wpdb->query($sql) ) { … … 566 567 } 567 568 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 */585 569 function admin_validate() { 586 570 global $message; … … 606 590 } 607 591 } 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 608 609 } 609 610 -
trunk/bp-xprofile/bp-xprofile-templatetags.php
r1847 r1868 396 396 $selected = ''; 397 397 } 398 399 400 398 401 399 $html .= apply_filters( 'bp_get_the_profile_field_options_select', '<option' . $selected . ' value="' . attribute_escape( $options[$k]->name ) . '">' . attribute_escape( $options[$k]->name ) . '</option>', $options[$k] ); 402 400 }
Note: See TracChangeset
for help on using the changeset viewer.