WordPress.org

Ready to get started?Download WordPress

Forums

Validate user profile when update? (1 post)

  1. tienthanh
    Member
    Posted 1 year ago #

    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;}
        }

Topic Closed

This topic has been closed to new replies.

About this Topic