[buddypress-trac] [BuddyPress Trac] #5472: xprofile_insert_field -> type - 'option' not allowed?

buddypress-trac noreply at wordpress.org
Thu Mar 20 23:53:21 UTC 2014


#5472: xprofile_insert_field -> type - 'option' not allowed?
--------------------------+-----------------------------
 Reporter:  shanebp       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Core          |    Version:  1.9.2
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 When using a script to populate xprofile fields, this works:

 {{{
    // in a loop
    xprofile_insert_field( array(
        'field_group_id'    => 1,
        'parent_id'     => $some_id,
        'type'          => 'selectbox',
        'name'          => $some_name,
        'option_order'  => $i
     ));
 }}}

 But option_order is not set in the db.
 Perhaps because 'type' is selectbox so option_order is ignored in
 class BP_XProfile_Field->save() ?

 But if 'type' => 'option', nothing is inserted.
 Perhaps because it fails here ?

 {{{
 // in function xprofile_insert_field()
 if ( !in_array( $type, (array) $bp->profile->field_types ) )
 }}}


 Populating xprofile selectboxes is a common chore.
 Being able to set the 'option_order' is important.
 I've been side-stepping it by using $wpdb->insert.
 But I was going to do a plugin re djpaul's comment in this thread:
 http://buddypress.org/support/topic/timestamps-in-members-
 timezone/#post-176014
 So I probably should use the 'BP Approved' approach - which isn't possible
 unless I missing something.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5472>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list