Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Jeremy Groot
/
stellervista-Intranet
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
4c19c8b0
authored
2023-03-01 16:46:38 -0500
by
Jeff Balicki
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
dddd
Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent
42afe874
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
1 deletions
wp-content/themes/understrap-child/functions.php
wp-content/themes/understrap-child/style.css
wp-content/themes/understrap-child/functions.php
View file @
4c19c8b
...
...
@@ -125,3 +125,46 @@ function um_logout_user_links_new( $args ) {
<?php
}
function
um_validate_email_domain
(
$args
)
{
// Change allowed email domains here
$allowed_email_domains
=
apply_filters
(
'um_allowed_email_domains'
,
array
(
'gotenzing.com'
,
'ekccu.com'
,
'stellervista.com'
)
);
// Change error message here
$message
=
__
(
'You can not use this email domain for registration'
,
'ultimate-member'
);
if
(
isset
(
$args
[
'user_email'
]
)
&&
is_email
(
$args
[
'user_email'
]
)
)
{
$email_domain
=
array_pop
(
explode
(
'@'
,
trim
(
$args
[
'user_email'
]
)
)
);
if
(
!
in_array
(
$email_domain
,
$allowed_email_domains
)
)
{
UM
()
->
form
()
->
add_error
(
'user_email'
,
$message
);
}
}
}
add_action
(
'um_submit_form_errors_hook__registration'
,
'um_validate_email_domain'
,
20
);
function
is_valid_email_domain
(
$login
,
$email
,
$errors
){
$valid_email_domains
=
array
(
"gotenzing.com"
,
"ekccu.com"
,
"stellervista.com"
);
// allowed domains
$valid
=
false
;
// sets default validation to false
foreach
(
$valid_email_domains
as
$d
){
$d_length
=
strlen
(
$d
);
$current_email_domain
=
strtolower
(
substr
(
$email
,
-
(
$d_length
),
$d_length
));
if
(
$current_email_domain
==
strtolower
(
$d
)
){
$valid
=
true
;
break
;
}
}
// Return error message for invalid domains
if
(
$valid
===
false
){
$errors
->
add
(
'domain_whitelist_error'
,
__
(
'<strong>ERROR</strong>: Registration is only allowed from selected approved domains. If you think you are seeing this in error, please contact the system administrator.'
));
}
}
add_action
(
'register_post'
,
'is_valid_email_domain'
,
10
,
3
);
\ No newline at end of file
...
...
wp-content/themes/understrap-child/style.css
View file @
4c19c8b
...
...
@@ -5,7 +5,7 @@
Author: the Understrap Contributors
Author URI: https://github.com/understrap/understrap-child/graphs/contributors
Template: understrap
Version: 1.2.00
19
Version: 1.2.00
20
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: understrap-child
...
...
Please
register
or
sign in
to post a comment