-
-
Save fahdi/8192726 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'user_profile_update_errors', 'validate_field' ); | |
function validate_field(&$errors, $update = null, &$user = null) | |
{ | |
if($user->has_cap('s2member_level2')) { // Custom fields only display to business accounts | |
// Nested if to check for field(s) | |
if ($_POST['exp_years']=='' or $_POST['exp_years']==NULL) // Change to check for empty or any regular expression. | |
{ | |
$errors->add('empty_exp_years', "ERROR: Please select a valid value for exp years!"); | |
} | |
}else if($user->has_cap('s2member_level3')) { | |
// Do this | |
}else { | |
// Do that! | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Solution to http://wpquestions.com/question/showLoggedIn/id/9118