function passbuilder_template($template) { $url = new UrlParams(); $current_role = Helper::getRole(); $urlParams = $url->getQueryArray(); if (array_key_exists('pass-builder', $urlParams)) { if (is_user_logged_in()) { if ($current_role != '') { // form submit handle here if ($_POST['formAction']) { $handler = new FormHandler($_POST['formAction']); $handler->handleSubmit(); } if ($_GET['action']) { $handler = new ActionHandler($_GET['action']); $handler->fireAction(); } return dirname(__FILE__) . '/templates/page-pass-template.php'; } else { return dirname(__FILE__) . '/templates/page-permission-exceptions.php'; } } else { $loginUrl = ICL_LANGUAGE_CODE == 'en' ? get_site_url() . '/log-in/' : get_site_url() . '/da/log-in-2/'; wp_redirect($loginUrl); } } return $template; }