API Request
-
I would like to request a change that would allow me to create a plugin that expands on the extended profile fields.
Where:
Near the end of thesave()
function in/bp-xprofile/bp-xprofile-classes.php
What:
Change the following line:
do_action_ref_array( 'xprofile_field_after_save', array( &$this ) );
to:
do_action_ref_array( 'xprofile_field_after_save', array( &$this, $field_id ) );
Alternatively, you could set
$this->id = $field_id
after an INSERT. That way the I can still access the ID field without needing to alter the behavior of thexprofile_field_after_save
action.This would allow me to write out a field in my custom table that references the newly saved profile field.
Thank you for your time and the great BuddyPress system!
JosephEDIT: For some reason I can’t reply to my topic (white screen so I am guessing there is a fatal error).
Thanks Paul, I will post there. A multiple insert is not an issue as this function only updates or inserts a single row. Here is the current code:
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_ref_array( 'xprofile_group_before_save', array( &$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 ( is_wp_error( $wpdb->query( $sql ) ) ) return false; do_action_ref_array( 'xprofile_group_after_save', array( &$this ) ); if ( $this->id ) return $this->id; else return $wpdb->insert_id; }
- The topic ‘API Request’ is closed to new replies.