Title: [WP-Authenticate] Authentication plugins not compatible with 2.6
Last modified: August 19, 2016

---

# [WP-Authenticate] Authentication plugins not compatible with 2.6

 *  [Paul](https://wordpress.org/support/users/abinidi/)
 * (@abinidi)
 * [17 years, 10 months ago](https://wordpress.org/support/topic/wp-authenticate-authentication-plugins-not-compatible-with-26/)
 * I just upgraded to 2.6, and I’ve discovered that the various plugins that are
   used to require authentication don’t work with 2.6, and I’m guessing it is because
   of the way cookies were changed in 2.6. However, I don’t know enough to fix the
   problem.
 * Does anybody have any suggestions on where I can look? Basically I’m either needing
   help fixing the code to check for the correct “logged-in” cookie, or I need help
   finding a new plugin (2.6 compatible, obviously) that allows me to require users
   to log in in order to see content on the blog.
 * Here is the old code for the plugin. I’m guessing a fix is probably pretty simple:
 *     ```
       class wpAuthenticate {
           /**
            * If the current page isn't 'wp-login.php' or 'wp-register.php', ensure the
            * user is logged in.
            *
            * @return void
            */
           public static function check_auth_to_read () {
               //If the current page isn't 'wp-login.php' or 'wp-register.php' redirect
               if ((strpos($_SERVER['PHP_SELF'], 'wp-login.php') === false) && (strpos($_SERVER['PHP_SELF'], 'wp-register.php') === false)) {
                   auth_redirect();
               }
           }
       }
       ```
   
 * Thanks for your help

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

 *  [PJ](https://wordpress.org/support/users/twothirty/)
 * (@twothirty)
 * [17 years, 10 months ago](https://wordpress.org/support/topic/wp-authenticate-authentication-plugins-not-compatible-with-26/#post-810071)
 * i second that. i use an authentication plugin that no longer works in 2.6 “Angsuman’s
   Authenticated WordPress Plugin”.
 *  775854
 * [17 years, 9 months ago](https://wordpress.org/support/topic/wp-authenticate-authentication-plugins-not-compatible-with-26/#post-810258)
 * I third that. I’m going through the code, I’ll post here if I can get it working.
 * Thanks,
 * Pamela
 *  775961
 * [17 years, 9 months ago](https://wordpress.org/support/topic/wp-authenticate-authentication-plugins-not-compatible-with-26/#post-810262)
 * I quadruple that 🙂
 * I run a private blog that I’ve had to disable completely until this gets fixed
   🙁
 *  775854
 * [17 years, 9 months ago](https://wordpress.org/support/topic/wp-authenticate-authentication-plugins-not-compatible-with-26/#post-810263)
 * Hey guys, there is a fix posted at the plugin home site ([http://xavisys.com/wordpress-authentication-plugin/](http://xavisys.com/wordpress-authentication-plugin/)):
 * > # July 18th, 2008 at 5:05 pm
   >  bread Says:
   > In my case, I modified wp-authenticate.php by this:
   > if ((strpos($_SERVER[‘PHP_SELF’], ‘wp-login.php’) === false) && (strpos($_SERVER[‘
   > PHP_SELF’], ‘wp-register.php’) === false)) {
   >  if ( !is_user_logged_in() ) {
   > auth_redirect(); } }
   > Then, it works with WP 2.6.
 * Hope that helps at least for this one plugin.
 * Pamela
 *  778200
 * [17 years, 9 months ago](https://wordpress.org/support/topic/wp-authenticate-authentication-plugins-not-compatible-with-26/#post-810271)
 * Be careful though. It is easy to goof that up (I wasn’t the only one). You are
   really only adding the second if statement.
 * Hopefully this will help:
 * Look at this code here (from the plug in [site](http://xavisys.com/wordpress-authentication-plugin/)):
 * if ((strpos($_SERVER[‘PHP_SELF’], ‘wp-login.php’) === false) && (strpos($_SERVER[‘
   PHP_SELF’], ‘wp-register.php’) === false)) {
    auth_redirect(); }
 * Now, Make it look like this:
 * if ((strpos($_SERVER[‘PHP_SELF’], ‘wp-login.php’) === false) && (strpos($_SERVER[‘
   PHP_SELF’], ‘wp-register.php’) === false)) {
    if ( !is_user_logged_in() ) { auth_redirect();}}
 * that should clear it all up, doing this made it work like a charm for me.
 *  779512
 * [17 years, 9 months ago](https://wordpress.org/support/topic/wp-authenticate-authentication-plugins-not-compatible-with-26/#post-810273)
 * hi bwakefield, I made the change and I cannot activate the plugin in WordPress
   2.6
 * Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION
   or T_VAR or ‘}’ in /hermes/bosweb/…/blog/wp-content/plugins/wp-authenticate.php
   on line 23
 * line 23 = “public static function check_auth_to_read () {”
 *  [flick](https://wordpress.org/support/users/mosey/)
 * (@mosey)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/wp-authenticate-authentication-plugins-not-compatible-with-26/#post-810280)
 * Perhaps you can post your complete edit of that section? It just looks as though
   a `}` is missing, as per the error message.
 *  779512
 * [17 years, 9 months ago](https://wordpress.org/support/topic/wp-authenticate-authentication-plugins-not-compatible-with-26/#post-810281)
 * Error when activate the following plugin:
    Parse error: syntax error, unexpected
   T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /hermes/bosweb/
   web031/b313/sl.adejeffc/public_html/blog/wp-content/plugins/wp-authenticate.php
   on line 12
 * the following is the whole file of the plugin:
 * >  <?php
   >  /** * Plugin Name: Authenticate * Plugin URI: [http://xavisys.com/wordpress-authentication-plugin/](http://xavisys.com/wordpress-authentication-plugin/)*
   > Description: Instantly requires that users be logged in to visit your site.
   > Also serves as a good base for expansion. No interface, just activate and go!*
   > Author: Aaron Campbell * Version: 1.0.0 * Author URI: [http://xavisys.com/](http://xavisys.com/)*/
   > class wpAuthenticate {
   >  public static function check_auth_to_read () {
   >  if ((strpos($_SERVER[‘PHP_SELF’],‘
   > wp-login.php’) === false) && (strpos($_SERVER[‘PHP_SELF’], ‘wp-register.php’)
   > === false)) { if ( !is_user_logged_in() ) { auth_redirect(); } } } } }
   > add_filter(‘init’, array(‘wpAuthenticate’,’check_auth_to_read’));
 *  [flick](https://wordpress.org/support/users/mosey/)
 * (@mosey)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/wp-authenticate-authentication-plugins-not-compatible-with-26/#post-810283)
 * Thanks. Try removing an extra } perhaps? There are 4x { tags as far as I can 
   see, and 5x } ones.
 *  [sindark](https://wordpress.org/support/users/sindark/)
 * (@sindark)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/wp-authenticate-authentication-plugins-not-compatible-with-26/#post-810284)
 * I have stopped updating my private blog, since every new version of WordPress
   seems to break Angsuman’s Authenticated WordPress Plugin.
 *  779512
 * [17 years, 9 months ago](https://wordpress.org/support/topic/wp-authenticate-authentication-plugins-not-compatible-with-26/#post-810285)
 * turns out it’s because my server php version is 4.4.7
    so it doesn’t recognize
   the public static
 * my code looks like the following now and I can activate it
    However, when I go
   to my blog index page (not log in yet), the page is blank :X
 * >  <?php
   >  /** * Plugin Name: Authenticate * Plugin URI: [http://xavisys.com/wordpress-authentication-plugin/](http://xavisys.com/wordpress-authentication-plugin/)*
   > Description: Instantly requires that users be logged in to visit your site.
   > Also serves as a good base for expansion. No interface, just activate and go!*
   > Author: Aaron Campbell * Version: 1.0.0 * Author URI: [http://xavisys.com/](http://xavisys.com/)*/
   > class wpAuthenticate {
   >  function check_auth_to_read () {
   >  if ((strpos($_SERVER[‘PHP_SELF’], ‘wp-login.
   > php’) === false) && (strpos($_SERVER[‘PHP_SELF’], ‘wp-register.php’) === false)){
   > if ( !is_user_logged_in() ) { auth_redirect(); } } } }
   > add_filter(‘init’, array(‘wpAuthenticate’,’check_auth_to_read’));
   >  ?>
 *  [croila](https://wordpress.org/support/users/croila/)
 * (@croila)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/wp-authenticate-authentication-plugins-not-compatible-with-26/#post-810331)
 * I’ve upgraded to 2.6 and when I use the code adejeffchen pasted in above, I just
   get a kind loop of permanent redirecting without it getting anywhere!
 * Does anyone know of any other plugins like this which work with WP2.6?
 *  [kraucrow](https://wordpress.org/support/users/kraucrow/)
 * (@kraucrow)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/wp-authenticate-authentication-plugins-not-compatible-with-26/#post-810395)
 * I also get loop of permanent redirecting. Did anyone come up with the solution
   to it?
 *  [kraucrow](https://wordpress.org/support/users/kraucrow/)
 * (@kraucrow)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/wp-authenticate-authentication-plugins-not-compatible-with-26/#post-810396)
 * The problem was with ‘
    That’s the plugin that works with 2.6: [http://marius.php.lt/project/wp-auth/wp-authenticate.php.txt](http://marius.php.lt/project/wp-auth/wp-authenticate.php.txt)

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

The topic ‘[WP-Authenticate] Authentication plugins not compatible with 2.6’ is 
closed to new replies.

## Tags

 * [authentication](https://wordpress.org/support/topic-tag/authentication/)

 * 14 replies
 * 10 participants
 * Last reply from: [kraucrow](https://wordpress.org/support/users/kraucrow/)
 * Last activity: [17 years, 7 months ago](https://wordpress.org/support/topic/wp-authenticate-authentication-plugins-not-compatible-with-26/#post-810396)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
