users – Change a subsite Admin role of a WordPress Multisite after 24 hours registering
Question
please I am trying to change WordPress multisite users’ role after registration. So a new user can register and create a subsite and after 24 hours the users’ role changes to the subscriber role. The reason I am doing this is to make sure they submit a KYC/Means of Identification on or before 24 hours of creating the subsite. I tried with the code below, but having issues implementing the time.
Please I will appreciate all contributions and support to this topic.
function woo_admin_to_editor($blog_id, $user_id) {
switch_to_blog($blog_id);
$user = new WP_User($user_id);
if ($user->exists()) {
$user->set_role('subscriber');
}
restore_current_blog();
}
add_action( 'wpmu_new_blog', 'woo_admin_to_editor', 10, 2 );
0
1 month
2023-02-14T07:09:22-05:00
2023-02-14T07:09:22-05:00 0 Answers
0 views
0
Leave an answer