role is found in array of allowed role, no redirection needed * */ $current_user = wp_get_current_user(); $allowed_roles = array($role_admin, $role_fipf); if (array_intersect($allowed_roles, $current_user->roles)) return; /* * if partner, redirect * */ if (current_user_can($role_partner)) { redirect_home_CIPF(); } /* * if connected user is not author, get out * */ // the way to find the id of the author of an author_page $author_id = get_queried_object_id(); $current_user_id = get_current_user_id(); if ($current_user_id != $author_id) { redirect_home_CIPF(); } /* * if connected prof is new, redirect to form commande * */ if (is_account_new_CIPF()) { redirect_command_CIPF(); } } add_action('template_redirect', 'prof_profil_redirects_CIPF', 11); /* * time to upload some scripts and styles on prof profil page * */ function prof_profil_scripts_CIPF() { Plgntls::debug_infos(2); // is an author page if (!is_author()) return; Plgntls::debug_infos(); // the way to find the id of the author of an author_page $author_id = get_queried_object_id(); display_states_css_CIPF($author_id); } add_action('wp_enqueue_scripts', 'prof_profil_scripts_CIPF', 11); ?>