Last active
June 8, 2023 00:39
-
-
Save hivepress/16fa87cfcae95e2927bea6d802d1a12d to your computer and use it in GitHub Desktop.
Make the profile image required for users #hivepress #users
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_filter( | |
'hivepress/v1/forms/user_update/errors', | |
function( $errors, $form ) { | |
$user = $form->get_model(); | |
if ( $user && ! $user->get_image__id() ) { | |
$errors[] = 'Please upload the profile image.'; | |
} | |
return $errors; | |
}, | |
100, | |
2 | |
); | |
add_filter( | |
'hivepress/v1/forms/user_update', | |
function( $form ) { | |
$form['fields']['image']['statuses']['optional'] = null; | |
return $form; | |
}, | |
1000 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment