Changeset 3396
- Timestamp:
- 11/11/2010 07:15:18 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-xprofile/bp-xprofile-classes.php
r3383 r3396 738 738 739 739 if ( $profiledata = $wpdb->get_row( $sql ) ) { 740 $this->id = $profiledata->id; 741 $this->user_id = $profiledata->user_id; 742 $this->field_id = $profiledata->field_id; 743 $this->value = stripslashes( $profiledata->value ); 744 $this->last_updated = $profiledata->last_updated; 745 } 746 } 747 740 $this->id = $profiledata->id; 741 $this->user_id = $profiledata->user_id; 742 $this->field_id = $profiledata->field_id; 743 $this->value = stripslashes( $profiledata->value ); 744 $this->last_updated = $profiledata->last_updated; 745 } 746 } 747 748 /** 749 * exists () 750 * 751 * Check if there is data already for the user. 752 * 753 * @global object $wpdb 754 * @global array $bp 755 * @return bool 756 */ 748 757 function exists() { 749 758 global $wpdb, $bp; 750 759 751 /* Check to see if there is data already for the user. */ 752 $sql = $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_data} WHERE user_id = %d AND field_id = %d", $this->user_id, $this->field_id ); 753 754 if ( !$wpdb->get_row( $sql ) ) 755 return false; 756 757 return true; 758 } 759 760 761 $retval = $wpdb->get_row( $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_data} WHERE user_id = %d AND field_id = %d", $this->user_id, $this->field_id ) ); 762 763 return apply_filters( 'xprofile_data_exists', (bool)$retval, $this ); 764 } 765 766 /** 767 * is_valid_field() 768 * 769 * Check if this data is for a valid field. 770 * 771 * @global object $wpdb 772 * @global array $bp 773 * @return bool 774 */ 760 775 function is_valid_field() { 761 776 global $wpdb, $bp; 762 777 763 /* check to see if this data is actually for a valid field. */ 764 $sql = $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_fields} WHERE id = %d", $this->field_id ); 765 766 if ( !$wpdb->get_row( $sql ) ) 767 return false; 768 769 return true; 778 $retval = $wpdb->get_row( $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_fields} WHERE id = %d", $this->field_id ) ); 779 780 return apply_filters( 'xprofile_data_is_valid_field', (bool)$retval, $this ); 770 781 } 771 782 … … 773 784 global $wpdb, $bp; 774 785 775 $this->user_id 776 $this->field_id 777 $this->value 778 $this->last_updated 786 $this->user_id = apply_filters( 'xprofile_data_user_id_before_save', $this->user_id, $this->id ); 787 $this->field_id = apply_filters( 'xprofile_data_field_id_before_save', $this->field_id, $this->id ); 788 $this->value = apply_filters( 'xprofile_data_value_before_save', $this->value, $this->id ); 789 $this->last_updated = apply_filters( 'xprofile_data_last_updated_before_save', date( 'Y-m-d H:i:s' ), $this->id ); 779 790 780 791 do_action( 'xprofile_data_before_save', $this );
Note: See TracChangeset
for help on using the changeset viewer.