Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
revoke_super_admin example
}
// Update the user.
$errors
=
edit_user
(
$user_id
)
;
// Grant or revoke super admin status if requested.
if
(
is_multisite
(
)
&&
is_network_admin
(
)
&& ! IS_PROFILE_PAGE &&
current_user_can
(
'manage_network_options'
)
&& !
isset
(
$super_admins
)
&&
empty
(
$_POST
[
'super_admin'
]
)
===
is_super_admin
(
$user_id
)
)
{
empty
(
$_POST
[
'super_admin'
]
)
?
revoke_super_admin
(
$user_id
)
:
grant_super_admin
(
$user_id
)
;
}
if
(
!
is_wp_error
(
$errors
)
)
{
$redirect
=
add_query_arg
(
'updated', true,
get_edit_user_link
(
$user_id
)
)
;
if
(
$wp_http_referer
)
{
$redirect
=
add_query_arg
(
'wp_http_referer',
urlencode
(
$wp_http_referer
)
,
$redirect
)
;
}
wp_redirect
(
$redirect
)
;
exit
;
}