Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author doublesharp

    (@doublesharp)

    @ ikivanov I am not able to see your screenshots, it looks like the link has expired. Can you please provide them again as well as let me know what version of WordPress and ACF you are using? If you could take a look at your console as well and let me know if there are any javascript errors.

    Thanks!

    Thread Starter ikivanov

    (@ikivanov)

    http://we.tl/9fmEAklIVi

    Here is the link again. I did screenshots of the field setup and the message with console log.
    No JS errors.

    What I am trying to do is to change one ACF text field to validated text field which will accept only numbers for a phone number. Then it should be unique for a custom post type.

    Let me know if I can help with providing more info.
    Thanks for your plugin and support.
    The link last 7 days.

    Plugin Author doublesharp

    (@doublesharp)

    @ikivanov – thanks, I was able to reproduce the error and found some bad SQL when checking for unique values per post_type. It has been corrected and I just pushed out a new version of the plugin. 1.0.3.

    Thanks!

    Thread Starter ikivanov

    (@ikivanov)

    Thanks, I will check it in a couple of days and will let you know if it worked.

    Thread Starter ikivanov

    (@ikivanov)

    Just updated the plugin and got this after I tried to update a post

    Notice: Undefined index: value in …/plugins/validated-field-for-acf/validated_field_v4.php on line 45

    Notice: Undefined index: value in …/plugins/validated-field-for-acf/validated_field_v4.php on line 45

    Warning: Cannot modify header information – headers already sent by (output started at …/plugins/validated-field-for-acf/validated_field_v4.php:45) in …/wp-admin/post.php on line 233

    Warning: Cannot modify header information – headers already sent by (output started at …/plugins/validated-field-for-acf/validated_field_v4.php:45) in …/wp-includes/pluggable.php on line 896

    However, it saved the value.
    Then I tried with a value which won’t pass. It showed the error but then even if I key a correct value it acts the same as before.

    Thread Starter ikivanov

    (@ikivanov)

    Also,
    if I update the post it will throw an error. Does the edited post is excluded from the check for unique field value?

    Plugin Author doublesharp

    (@doublesharp)

    I just pushed version 1.0.4 which includes a fix for the PHP notices as well as a Javascript error.

    The plugin does exclude the current post from the check. Once you upgrade to the latest version if you are still having an issue please open a new thread with the details so I can follow up (the issue on this should now be resolved). If you want to check out the source code, the unique checks begin here https://plugins.trac.wordpress.org/browser/validated-field-for-acf/tags/1.0.4/validated_field_v4.php#L124 and the SQL for the post_type check is here https://plugins.trac.wordpress.org/browser/validated-field-for-acf/tags/1.0.4/validated_field_v4.php#L131

    SQL prefix

    $sql_prefix = "select meta_id, post_id, p.post_title from {$wpdb->postmeta} pm join {$wpdb->posts} p on p.ID = pm.post_id and p.post_status = 'publish'";

    post_type SQL

    case 'post_type':
        // check to see if this value exists in the postmeta table with this $post_id
        $sql = $wpdb->prepare("{$sql_prefix} and p.post_type = %s where post_id != %d and meta_value = %s", $post_type, $post_id, $val);
        break;

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Can not pass any validation’ is closed to new replies.