WordPress.org

Support

Support » How-To and Troubleshooting » Validate user profile when update?

Validate user profile when update?

  • Hi all, i want to check a user meta value exist or not when a user updating their profile. If exist then display a message on user profile page. I have use profile_update action but it not as I expected. Anyone can help me?

    Here is my code:

    add_action( 'profile_update', 'my_profile_update' );
    
        function my_profile_update( $user_id, $old_user_data ) {
    		$meta_key="facebook-connect";
    		$meta_value=preg_replace('#[^\w()/.%\-&]#',"",$_POST["facebook-connect"]);
    		$uc = get_users(array('meta_key' => $meta_key, 'meta_value' => $meta_value));
    		if(COUNT($uc)==1){return;}
        }
  • The topic ‘Validate user profile when update?’ is closed to new replies.
Skip to toolbar