Skip to:

Bug Report: Default Name Field Generation

  • TruthMedia



    Just letting you know we’ve found some “sketchy” code in BP that could be improved. Probably won’t affect 80% of users, but here it is…

    Version: 1.7.1
    File: bp-core/admin/bp-core-schema.php
    Lines: 308-309`
    if ( !$wpdb->get_var( “SELECT id FROM {$bp_prefix}bp_xprofile_fields WHERE id = 1” ) )
    $insert_sql[] = “INSERT INTO {$bp_prefix}bp_xprofile_fields ( group_id, parent_id, type, name, description, is_required, can_delete ) VALUES ( 1, 0, ‘textbox’, ” . $wpdb->prepare( ‘%s’, stripslashes( bp_get_option( ‘bp-xprofile-fullname-field-name’ ) ) ) . “, ”, 1, 0 );”;

    When we first installed BuddyPress, we removed the “name” field in favour of using a combination of FirstName/LastName. Now, any time we do a major upgrade, BP creates a new required “Name” field in the database.

    The Problem:
    You are searching for a field with “id=1” but when you create it, you don’t give it an ID of 1. This code makes the assumption that it is running on a new install, and therefore the database table must be empty. In our situation above, it is creating a new “Name” field but uses the auto-increment ID so the field never does have ID = 1. A similar problem appears to exist in the preceding lines as well when creating the group.

    The Solution:
    Many possible solutions exist. One might be to create the field with an ID of 1 hardcoded. Another might be to test for the existence of a field where name = ‘Name’.


    EDIT: typo.

Viewing 2 replies - 1 through 2 (of 2 total)

  • Henry



    You can submit your bug report here. This way the developers will catch sight of it.

    Suzan Jasmin O.


    Hi truthmedia
    I have the latest Wp and latest BuddyPress 1.9.2
    On the new user registration form it has FULL NAME box
    But I need FIRST NAME and LAST NAME boxes. So I can in admin panel and users on frontend can register new users can fill their names with 2 boxes. And on search page users can search other users by first name or last name. And I can hide last names for some users etc.. Its always convenient to have first and last names in separate DB columns. So please help me out, how can I have the BuddyPress plugged site of mine to function like above?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Bug Report: Default Name Field Generation’ is closed to new replies.
Skip to toolbar