Profile Field Setup Cant Add SelectBox Fields

WordPress MU 2.8.6.
Buddypress Version 1.1.2

I Can Add Groups, and can Add Fields of Type Text or MultiLine, but options, Dropdowns, and checkboxes fail with "There was an error saving the field. Please try again"

The Field Saves but The Options for the Field do not.

  • ASPDNoble

    Still not Working after freash Install No Plugins

    There was an error saving the field. Please try again

    When adding Fields of type selectbox, multiselectbox, checkboxes, or any type of multi selection field to the Profile Field Setup I Get
    "There was an error saving the field. Please try again"
    WPMU: 2.8.6
    BP: 1.1.2

    1. The Field Creates but the selections do not
    2. Text Boxes and Multiline text boxes work fine
    3. Adding and Removing Groups works Fine.
    4. I have performed a complete reinstall (No Joy)

    a. What Table Holds the Selections for User Defined Multi-Selecion Profile Fields?
    b. Can I just enter the selection values for a field manually, and where?
    c. If I Had many Selection Values e.g. Countries or States, can I Import them? and Where?

    Thanks, Stopped cold and need to figure out what I did as soon as possible.

  • Andrew


    I'm afraid I don't know what's causing this. It seems other people have experienced this problem though:

    What I would do if this we're to happen on one of our sites is find the section of code tossing the error message and see why the error is getting tossed.


  • ASPDNoble

    Thanks Andrew,

    I had Already Seen both of these but am at a loss how to narrow the scope to the section of code tossing the error. Also I Upgraded to 1.1.3 which came out over the holiday and no Joy but this was not mentioned in the release history anyway.

    1. Adding Directly into the Table like the person did in does solve the immediate issue but Im not 100% sure of the Values that should be placed in the records of the wp_bp_xprofile_fields. Particularly The expected Value for the Type Field. I used the value "Option" and that seems to work. The rest of the topograhy of the table is self evident.

    2. Its clearly an issue with the Append query / loop that appends the Values to the base Field in wp_bp_xprofile_fields, but I cant find the place where this query / loop exists. I can Only locate the point of failure.

    a. !$group->save() is OK but !$field->save() is not. Maybe I'm just thick but where is the save() Function / Sub Routine?

    b. Further I don't see anything in this function that handles the values associated with the field so I'm confused :slight_frown:

    File: bp-xprofile-admin.php
    function xprofile_admin_manage_field( $group_id, $field_id = null ) {
    global $bp, $wpdb, $message, $groups;

    $field = new BP_XProfile_Field($field_id);
    $field->group_id = $group_id;

    if ( isset($_POST['saveField']) ) {
    if ( BP_XProfile_Field::admin_validate() ) {
    $field->name = wp_filter_kses( $_POST['title'] );
    $field->description = wp_filter_kses( $_POST['description'] );
    $field->is_required = wp_filter_kses( $_POST['required'] );
    $field->type = wp_filter_kses( $_POST['fieldtype'] );
    $field->order_by = wp_filter_kses( $_POST["sort_order_{$field->type}"] );

    $field->field_order = $wpdb->get_var( $wpdb->prepare( "SELECT field_order FROM {$bp->profile->table_name_fields} WHERE id = %d", $field_id ) );

    if ( !$field->field_order ) {
    $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 ) );


    if ( !$field->save() ) {
    $message = __('There was an error saving the field. Please try again', 'buddypress');
    $type = 'error';

    xprofile_admin($message, $type);
    } else {
    $message = __('The field was saved successfully.', 'buddypress');
    $type = 'success';


    do_action( 'xprofile_fields_saved_field', $field );

    $groups = BP_XProfile_Group::get_all();
    xprofile_admin( $message, $type );
    } else {
    } else {

  • ASPDNoble


    Another Piece to My Previous Post. This is more than I wanted to know about PHP and buddy press but once I start something I finish.

    Thanks For Your Help. I Joined because I found BuddyPress's forum a bit weak and to see if I could find a forum that was actually helpful. So far am very glad I did so.

    Im starting to wonder if this isn't a PHP issue. I banged my head against the wall with wordpress for a week before I determined that much of Wordpress and many themes depend on the ShortCode Option in PHP.ini. This issue feels a lot like that.

    Additional Information:
    I Found the Save() Function but now I cant decide if the issue is that
    - apply_Filters() --- is not functioning
    - do_action( 'xprofile_group_before_save', $this ); --- I'snt Saving
    - or prepare() --- Is not Preparing the Query correctly.

    function save() {
    global $wpdb, $bp;

    $this->name = apply_filters( 'xprofile_group_name_before_save', $this->name, $this->id );
    $this->description = apply_filters( 'xprofile_group_description_before_save', $this->description, $this->id );

    do_action( 'xprofile_group_before_save', $this );

    if ( $this->id ) {
    $sql = $wpdb->prepare( "UPDATE {$bp->profile->table_name_groups} SET name = %s, description = %s WHERE id = %d", $this->name, $this->description, $this->id );
    } else {
    $sql = $wpdb->prepare( "INSERT INTO {$bp->profile->table_name_groups} (name, description, can_delete) VALUES (%s, %s, 1)", $this->name, $this->description );

    if ( !$wpdb->query($sql) )
    return false;

    do_action( 'xprofile_group_after_save', $this );

    return true;

  • hexone19

    I found out why this occurs...

    It's your MYSQL set needs to be 5.0 and above. I had this happen to me and i installed and uninstalled WPMU and Buddypress and plugins a million times..then I got the inkling to check my database when I tried to install the buddypress event plugin and i got the same issues..

    I had a feeling it was a 4.0 db and I was I did the install once more in a 5.0 set up and voila! works like a charm now...

    So..check your DB...

  • ASPDNoble

    Thanks for all the Posts. The Solution was bizarre and maybe someone can explain how the field defenition for this field in this table was created wrong by the install.

    1. Open wp_bp_xprofile_fields table in design view
    2. The order_by field default value is Null
    3. The Column Options for the order_by field is set to Not Null

    Basically the Default is Null and the Column option is set to not allow null so the Records for Dropdowns, Options, and Checkboxes cant be saved.


    The Append Loop should be providing a value for order_by and isn't

    1. I was on version 5.1 of MYSQL
    2. Didnt try AddType x-mapp-php5 .php in the htaccess

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.