Please can you add a bit more information on this? In what way does it not work? Just the returning part, or somewhere else? Do you get error messages? What are they?
What’s the purpose of the two underline characters before your return value inside the if() clause? If I do that in plain-vanilla PHP test, I get a parse error.
return __( $tpt ."". $tpt2 );
^ here
I don’t know the various platforms you are using, but if this line is correct:
$product_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM
$wpdb->postmeta WHERE meta_key='musteri_kimlik_numarasi' AND
meta_value='%s' LIMIT 1", $kimlikno ) );
don’t you need the $wpdb-> before your get_field() and the_field() calls too, or are they separate functions somewhere? I’m guessing, though, without more detail on how it fails.
Let me explain the problem. Customers, Employees and so on. I’ve created 2 different post types. (CPT UI & ACF) There is a musteri_kimlik_no and musteri_danismani field on the Customers page. musteri_danismani field pulls data from the Employees page. Employees page has fields like calisan_adi_soyadi and calisan_sirket_numarasi.
Now,
I created a form in the frontend(WP User Frontend). When customers complete this form, the data is printed in the corresponding fields on the Customers page and creates a new customer. For the fields that are unique in this form, I query whether the record exists in the system and print an error on the screen. For example: musteri_kimlik_no has to be filled in uniquely. If musteri_kimlik_no is registered in the system, I would like to withdraw the musteri_danismani field from the relevant customer page. I want to pull the data(calisan_adi_soyadi and calisan_sirket_numarasi) from the Employees page using the musteri_danismani field and print it to the error screen.
If you saying another way for getting data i can see it
When i using this code;
function wpuf_unique_kimlik_no_uyari( $error ) {
if ( isset( $_POST['musteri_kimlik_numarasi'] ) ) {
global $wpdb;
$kimlikno = $_POST['musteri_kimlik_numarasi'];
$product_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key='musteri_kimlik_numarasi' AND meta_value='%s' LIMIT 1", $kimlikno ) );
if ( $product_id ) {
return $product_id;
}
}
return '';
}
add_filter( 'wpuf_add_post_validate', 'wpuf_unique_kimlik_no_uyari' );
“return $product_id;”
The error screen shows the id of the page that contains the data entered in the musteri_kimlik_no field.
In other words, product_id is the id of the page that contains the data entered in the musteri_kimlik_no field.
And i use get_field But not working Submit form validation doesn’t work when i change return code :S