function hw2contracts_nua_custom_email_admins_hw2($to, $user_email) { $user = get_user_by('email', $user_email); $role = \Hw2CF\FormHelper::getUserFirstRole($user->ID); if ($role == "hw2_contributor" || $role == "hw2_partner") { $to = array(\Hw2CF\Opts::I()->hw2cf_email); } return $to; }
function hw2contracts_user_login($user_login, $user) { $user_id = $user->ID; $role = \Hw2CF\FormHelper::getUserFirstRole($user->ID); if ($role == "hw2_contributor" || $role == "hw2_partner") { $first_login = get_user_meta($user_id, 'first_login_done', false); if ($first_login == false) { // update meta after first login update_user_meta($user_id, 'first_login_done', '1'); // redirect to given URL wp_redirect(bloginfo("url") . '/' . Conf::$hw2cf_page_alias . "/?user=" . $user->ID); exit; } } }