[buddypress-trac] [BuddyPress Trac] #5916: Action xprofile_field_after_save has no way of knowing field_id for newly created field

buddypress-trac noreply at wordpress.org
Mon Sep 29 14:18:53 UTC 2014


#5916: Action xprofile_field_after_save has no way of knowing field_id for newly
created field
-------------------------+-----------------------------
 Reporter:  tometzky     |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  XProfile     |    Version:  2.1
 Severity:  minor        |   Keywords:
-------------------------+-----------------------------
 Action xprofile_field_after_save may need field_id number of newly created
 field. But it has no way of knowing it - it can't use $wpdb->insert_id, as
 other inserts might be performed if there are any support options defined.

 Please add some way to check just created field_id in this hook. For
 compatibility it would be preferred to leave empty $field->id and create
 another field for newly created id, as some plugins may check for it to
 know it the field is new.

 Something like:
 {{{#!php
 $new_id = $wpdb->insert_id;
 /* ... */
 $field_arr = array( $this );
 $field_arr['new_id'] = $new_id;
 /* ... */
 do_action_ref_array( 'xprofile_field_after_save', $field_arr );
 }}}


 I need this for my plugin "BuddyPress XProfile Validate with RegEx" - I
 have no way of saving data typed by users while creating a new field, as I
 don't know the id.

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


More information about the buddypress-trac mailing list