Created
September 20, 2023 06:43
-
-
Save nextab/32c3afa7abc4528e2fdacb1796ca7376 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #region Check if user e-mail is unique | |
| function jet_fb_v_check_user_email($value, $context): bool { | |
| if (!is_user_logged_in()) { | |
| return !in_array($value, get_all_user_emails()); | |
| } | |
| return get_user_data() === $value; | |
| } | |
| #endregion Check if user e-mail is unique | |
| #region Get all user e-mails and return them as an array | |
| function get_all_user_emails() { | |
| $emails = array(); // Initialize an empty array to hold the email addresses | |
| // Query to get all user data | |
| $users = get_users(); | |
| // Loop through each user to fetch their email | |
| foreach ($users as $user) { | |
| $emails[] = $user->user_email; | |
| } | |
| return $emails; // Return the array of email addresses | |
| } | |
| #endregion Get all user e-mails and return them as an array |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Warum nicht einfach email_exists() oder username_exists()? :)