I found bug in Conditional Profile Fields for BuddyPress plugin.
foreach ( $related_fields['conditions'] as $condition ) {
// check if condition is matched.
if ( $this->is_match( $data, $condition['value'], $condition['operator'] ) ) {// if visibility is set to hidden and condition matched,
// delete data for the field on which this condition is applied.
if ( $condition['visibility'] === 'hide' ) {
xprofile_delete_field_data( $condition['field_id'], $user_id );
}
} else {
// if there is no match and the visibility is set to show on condition,
// we still need to delete the data for the field on which this condition is applied.
if ( $condition['visibility'] === 'show' ) {
xprofile_delete_field_data( $condition['field_id'], $user_id );
}
}
}
Please see the comment above that line.
// if there is no match and the visibility is set to show on condition, // we still need to delete the data for the field on which this condition is applied.
Regards
BrajeshHi Bharat,
It seems to me the code is correct.what we are doing is: If a condition does not match and the field is set to be visible, we remove the data for that field. It is opposite of if a field matches as the field is set to hidde.
I haven’t tested recently, if you are insisting, Will test and post tomorrow.
Regards
Brajesh
You must be logged in to reply to this topic.