Title: Validation Return Value Problem
Last modified: July 4, 2019

---

# Validation Return Value Problem

 *  Resolved [uniak](https://wordpress.org/support/users/uniak/)
 * (@uniak)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/validation-return-value-problem/)
 * I use validation 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 __( ‘This is an ERROR!’);}}
   return ”; } add_filter( ‘wpuf_add_post_validate’, ‘wpuf_unique_kimlik_no_uyari’);`
 * [user document page](https://wedevs.com/docs/wp-user-frontend-pro/developer-docs/filters/wpuf_add_post_validate/)
 * I want to add a value to return message like as:
 *     ```
       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 ) );
               $sonucc =  get_field('musteri_danismani', $product_id);
               $tpt = the_field('calisan_adi_soyadi', $sonucc);
               $tpt2 = the_field('calisan_sirket_numarasi', $sonucc);
               if ( $product_id ) {
                   return __( $tpt ."". $tpt2 );
               }
           }
           return '';
       }
       add_filter( 'wpuf_add_post_validate', 'wpuf_unique_kimlik_no_uyari' );
       ```
   
 * But doesn’t return a message. How can i do this ? Can u help me ?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fvalidation-return-value-problem%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Mehedi Hasan](https://wordpress.org/support/users/thebengalboy/)
 * (@thebengalboy)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/validation-return-value-problem/#post-11807871)
 * Hello [@uniak](https://wordpress.org/support/users/uniak/)
 * I’m really sorry for being late. My apologies.
 * However, where did you get the `the_field` function? I mean, how did you manage
   it?
 * We are not understanding the code you wrote. A few descriptions would be appreciable.
 * Regards,
 *  Thread Starter [uniak](https://wordpress.org/support/users/uniak/)
 * (@uniak)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/validation-return-value-problem/#post-11808675)
 * [@thebengalboy](https://wordpress.org/support/users/thebengalboy/) Thanks for
   your reply 🙂
 * I solved my problem.
 * the_field is a advanced custom field code. You can look at: [https://www.advancedcustomfields.com/resources/the_field/](https://www.advancedcustomfields.com/resources/the_field/)
 * I solved my problem with this code type:
 *     ```
       function wpuf_unique_identity_no_error( $error ) {
           if ( isset( $_POST['customer_identity_no'] ) ) {
               global $wpdb;   
               $identityno = $_POST['customer_identity_no'];
               $product_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key='customer_identity_no' AND meta_value='%s' LIMIT 1", $identityno ) );
             	$resultt =  get_field('customer_advisor', $product_id);
       		$tpt = get_field('customer_name_surname', 'user_'.$resultt);
       		$tpt2 = get_field('advisor_company_phone', 'user_'.$resultt);
       		$text1 = 'According to the information you have given your registration is in our system.<br/>Your advisor is: "<strong>';
       		$text2 = '</strong>" . You can contact him/her with <strong>';
       		$text3 = '</strong> phone number.';
       		$emp = 'According to the information you have given your registration is in our system.<br/> Your advisor has not yet been assigned. You can get information by calling <strong>+0 000 000 000</strong> phone number.';
       		if (( $product_id ) and (is_null($resultt))) {
       			return $emp;
       		}
       		elseif(( $product_id ) and ($resultt)) {
       			return $text1 . "" . $tpt . "" . $text2 . "" . $tpt2 . "" . $text3;
       		}
           }
           return '';
       }
       add_filter( 'wpuf_add_post_validate', 'wpuf_unique_identity_no_error' );
       ```
   
 *  [Mehedi Hasan](https://wordpress.org/support/users/thebengalboy/)
 * (@thebengalboy)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/validation-return-value-problem/#post-11811048)
 * Hello [@uniak](https://wordpress.org/support/users/uniak/)
 * Thanks for sharing the solution with us. We’ll definitely refer to this, people
   who will face the issue similarly.
 * Thanks

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Validation Return Value Problem’ is closed to new replies.

 * ![](https://ps.w.org/wp-user-frontend/assets/icon-256x256.gif?rev=2818776)
 * [User Frontend: AI Powered Frontend Posting, User Directory, Profile, Membership & User Registration](https://wordpress.org/plugins/wp-user-frontend/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-user-frontend/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-user-frontend/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-user-frontend/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-user-frontend/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-user-frontend/reviews/)

## Tags

 * [control](https://wordpress.org/support/topic-tag/control/)
 * [validate](https://wordpress.org/support/topic-tag/validate/)
 * [validation](https://wordpress.org/support/topic-tag/validation/)

 * 3 replies
 * 2 participants
 * Last reply from: [Mehedi Hasan](https://wordpress.org/support/users/thebengalboy/)
 * Last activity: [6 years, 9 months ago](https://wordpress.org/support/topic/validation-return-value-problem/#post-11811048)
 * Status: resolved