Title: [Plugin: WordPress Access Control] Website stops working when activating this plugin
Last modified: August 20, 2016

---

# [Plugin: WordPress Access Control] Website stops working when activating this plugin

 *  [testlink25](https://wordpress.org/support/users/testlink25/)
 * (@testlink25)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-wordpress-access-control-website-stops-working-when-activating-this-plugin/)
 * as soon as I activate this plugin, I get this error:
 * Fatal error: Call to undefined function is_user_logged_in() in /wp-content/plugins/
   wordpress-access-control/wordpress-access-control.php on line 774
 * any clue, I’m running other plugins as well including BPS Security and others.
   
   when I try to uninstall all plugins and lock an empty page, it locks my entire
   site and redirects to login page when I go to the homepage.
 * [http://wordpress.org/extend/plugins/wordpress-access-control/](http://wordpress.org/extend/plugins/wordpress-access-control/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [testlink25](https://wordpress.org/support/users/testlink25/)
 * (@testlink25)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-wordpress-access-control-website-stops-working-when-activating-this-plugin/#post-2637749)
 * the fact that it locks my entire website is my bad, the box (make blog member
   only)
    and just discovered that It’s not compatible with the plugin WP USER FRONT
   END.
 *  Thread Starter [testlink25](https://wordpress.org/support/users/testlink25/)
 * (@testlink25)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-wordpress-access-control-website-stops-working-when-activating-this-plugin/#post-2637752)
 * actually the error Fatal error: Call to undefined function is_user_logged_in()
   in /wp-content/plugins/wordpress-access-control/wordpress-access-control.php 
   on line 774 is triggered when i turn on the plugin WP USER FRONTEND.
 *  [theilldk](https://wordpress.org/support/users/theilldk/)
 * (@theilldk)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-wordpress-access-control-website-stops-working-when-activating-this-plugin/#post-2637969)
 * Thanks….. I a HHTP-500 error pretty critical.
 * And my error too was the WP user frontend
 *  [professor99](https://wordpress.org/support/users/professor99/)
 * (@professor99)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/plugin-wordpress-access-control-website-stops-working-when-activating-this-plugin/#post-2637990)
 * This is actually caused by a slight Access Control bug.
 * Access Control hooks the WordPress get_page() function during plugin load. Unfortunately
   it calls the pluggable function is_user_logged_in() which means it will crash
   WordPress if any other plugin calls this function after during plugin load.
 * Code from wordpress-access-control.php.
 *     ```
       add_filter( 'get_pages', array( 'WordPressAccessControl', 'get_pages' ) );
       ...
       class WordPressAccessControl
       {
       ...
       	function get_pages( $pages )
       	{
       		// Don't affect the display of pages when viewing the list in the admin
       		if ( is_admin() ) {
       			return $pages;
       		}
   
       		// Whether or not the user is logged in
       		$auth = is_user_logged_in();
       ...
       	}
       ...
       }
       ```
   
 * The ideal solution is to obtain the user id without using the pluggable functions
   and apply this hook before the plugins load but this isn’t so easy (try following
   the trail in pluggable.php).
 * A less perfect solution is to forgo the filtering of the pages during plugin 
   load and apply the action hook at high priority at the action hook ‘init’ which
   occurs after pluggables have been loaded and the user has been authenticated 
   as follows.
 * New code (NB delete old get_pages filter)
 *     ```
       add_action( 'init', array( 'WordPressAccessControl', 'add_get_page_hook' ), 0 );
   
       class WordPressAccessControl
       {
       ...
         function add_get_page_hook()
         {
           add_filter( 'get_pages', array( 'WordPressAccessControl', 'get_pages' ) );
         }
       ...
       }
       ```
   
 * However there is the slight risk that other plugins with this hook at priority
   0 that use get_page will miss out. You can use the following code to remove that
   possibility but no guarantees it will be future proof. It simply does what $wp-
   >init() does in wp-settings.php a little bit earlier to no ill effect.
 * New code (NB delete old get_pages filter)
 *     ```
       add_action( 'after_setup_theme', array( 'WordPressAccessControl', 'add_get_page_hook' ), 0 );
   
       class WordPressAccessControl
       {
       ...
         function add_get_page_hook()
         {
           wp_get_current_user();
   
           add_filter( 'get_pages', array( 'WordPressAccessControl', 'get_pages' ) );
         }
       ...
       }
       ```
   
 * As far as I can see this is the only Access Control hook that has this problem.
 * As to other plugins that cause this problem the one that has the most reports
   is WP User Frontend Version 1.1 but there is a new [development](http://wordpress.org/support/topic/frontend-updates-2rrr-fork?replies=70)
   version of this that fixes the problem.
 * Cheers
    TheProfessor

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘[Plugin: WordPress Access Control] Website stops working when activating
this plugin’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wordpress-access-control.svg)
 * [WordPress Access Control](https://wordpress.org/plugins/wordpress-access-control/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-access-control/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-access-control/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-access-control/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-access-control/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-access-control/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [professor99](https://wordpress.org/support/users/professor99/)
 * Last activity: [13 years, 2 months ago](https://wordpress.org/support/topic/plugin-wordpress-access-control-website-stops-working-when-activating-this-plugin/#post-2637990)
 * Status: not resolved