Created
March 30, 2016 17:36
-
-
Save Antoinebr/6dbd17e6bca62f68c3862975f02af129 to your computer and use it in GitHub Desktop.
Permet d'interdire des pages de l'admin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function forbidden_url(){ | |
| $forbidenUrls = array( | |
| 'theme-editor.php', | |
| 'themes.php', | |
| 'plugin-editor.php', | |
| 'plugin-install.php', | |
| 'plugins.php', | |
| 'export.php', | |
| 'post_type=acf-field-group', | |
| 'users.php' | |
| ); | |
| foreach ($forbidenUrls as $url) { | |
| if (strpos($_SERVER['REQUEST_URI'], $url) !== FALSE) { | |
| echo " | |
| <div style='text-align:center;'> | |
| <h2 >Pour des raisons de securite cette page n'est pas accesible avec votre compte. | |
| </br/> | |
| (Protection contre le telechargement des fichiers sources)</h2> | |
| <p>L'acces à cette partie sera débloqué après acceptation de la livraison</p> | |
| </div> | |
| "; | |
| die(); | |
| } | |
| } | |
| } | |
| if( is_user_logged_in()) : | |
| $user_id = get_current_user_id(); | |
| if($user_id !== 1) add_action('admin_init','forbidden_url'); | |
| endif; | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment