Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // @todo move this to after pre-save preparations
- // Verify unique fields
- if ( 1 == pods_var( 'unique', $options[ 'options' ], 0 ) && '' !== $value && null !== $value && array() !== $value && 0 !== $value && '0' !== $value ) {
- if ( empty( $pod ) )
- return false;
- if ( !in_array( $type, $tableless_field_types ) ) {
- $exclude = '';
- if ( !empty( $id ) )
- $exclude = "AND `id` != {$id}";
- $check = false;
- $check_value = pods_sanitize( $value );
- // @todo handle meta-based fields
- // Trigger an error if not unique
- if ( 'table' == $pod[ 'storage' ] )
- $check = pods_query( "SELECT `id` FROM `@wp_pods_" . $pod[ 'name' ] . "` WHERE `{$field}` = '{$check_value}' {$exclude} LIMIT 1", $this );
- if ( !empty( $check ) )
- return pods_error( sprintf( __( '%s needs to be unique', 'pods' ), $label ), $this );
- }
- else {
- // @todo handle tableless check
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement