WordPress Authentication Plugin

Posted by Aaron D. Campbell | Monday, December 18th, 2006
, ,

This plugin requires that a user be logged in to see any page in your blog (except the login and register pages).

Related Posts:

83 Responses to “WordPress Authentication Plugin”

  1. BGH Quiz says:

    Thank you, that’s exactly the sort of plugin I’ve been looking for throughout the past days. It perfectly works.

  2. where is the download?

  3. Sorry, a recent WordPress upgrade caused a bunch of my files to become detached from the posts they belonged to. I think I have them all fixed now, but this one is definitely fixed.

  4. om gargatte says:

    i wud like to know if its possible to make one particular page on wordpress to require wp login…
    means-
    to view de contents of tat page ,one must be ogged into as wp user….
    n to view de rest of de pages wp-login should not be neccesary…

    Om Gargatte

  5. Alfredo says:

    Plugin could not be activated cause it triggered a fatal error:

    Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /home/www/blog.agnitio.es/wp-content/plugins/wp-authenticate.php on line 23

    Fresh new install of WP 2.3.3

    Worked fine in WP 2.3.2 and still working in an upgrade to 2.3.3, but the error happened in a new install.

    Please help.

  6. Alfredo: Are you sure nothing else changed? It looks like you are getting an error that is usually associated with trying to run PHP 5 code on PHP 4. The plugin (as with everything else I do) requires PHP 5.

  7. om gargatte: That could be done, but this plugin does not do it. Consider putting a check in your theme’s page.php file that looks like this:
    < ?php if (777 == the_ID()) {auth_redirect();} ?>
    Replace “777″ with the ID of the page you want to require authentication for.

  8. Om Gargatte says:

    its just too kind of u to have replied.

    i tried doing it, but it resulted in de code shown up on de page…….

    page id is 4

  9. Om Gargatte says:

    hey, i ‘m not able to make it work:(
    its not doing de intended job, i mean it just allows everyone to view de page

  10. If the code is showing up, make sure it’s wrapped in php tags:
    < ?php ... ?>
    Other than that, what version of wordpress?

  11. Steve says:

    I also got the “Plugin encountered fatal error” when I tried activating the Authenticate plugin. After reading here that you’ve converted all your plugins to PHP 5, I switched my WP 2.3.3 installation to run on PHP 5. Thereafter the plugin and the rest of the blog is working fine.

    Suggestion: If the plugin requires PHP 5 to run at all, please indicate this up front in the README.TXT file and other documentation.

    Thank you for your work.

  12. ian says:

    Thank you for creating this plugin. FYI – I am using it successfully with Wordpress 2.5.

  13. Thanks for the update Ian, I tested it with 2.5.1 to make sure, and then fixed the readme in the repos to reflect that.

  14. George says:

    There is a problem running this plugin on WP2.5. As reported elsewhere, if you upload an image, WP shows the login box in the box after upload, instead of the image. Any ideas, as I would like to revert to usin this plugin?

  15. Chad says:

    I downloaded the plugin a few minutes ago and installed it on WordPress 2.5.

    2 small issues:
    Line 29: auth_redirect(); is commented out. It must be uncommented to actually work
    Line 7: Version is still listed as 1.0

    Otherwise, it DID work with WordPress 2.5!

    Thanks Aaron.

  16. Paul says:

    So, this plugin doesn’t seem to work on 2.6. Any suggestions?

  17. Paul says:

    BTW- the problem seems to be that WP 6 changed how cookies work, it that helps point out the solution.

  18. Frederik says:

    Do the following to make the plugin work with Wordpress 2.6:
    Change these to lines:

    $user = wp_signon();
    if ( is_wp_error($user) ) {

    to this line

    if ( !is_user_logged_in() ) {

  19. Frederik says:

    Should say “these two lines:”

  20. Sly says:

    Maybe I am blind but I can not see these two lines in the wp-authenticate.php .

  21. Mike P says:

    Frederik, the change you suggested worked like a charm…

    Thanks

  22. 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.

  23. SlyT says:

    Thanks a lot bread. It’s working now :) .

  24. Michael Hubbard says:

    I made the change that bread suggested, and I’m now getting the following error:

    Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in /[site]/wp-content/plugins/wp-authenticate.php on line 35

    Any suggestions?

  25. Ben says:

    Hopefully this will help:

    Look at this code here:
    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.

  26. Jeff says:

    After applying Ben’s suggestion, 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/web031/b313/sl.adejeffc/public_html/blog/wp-content/plugins/wp-authenticate.php on line 23

    line 23 = “public static function check_auth_to_read () {”

  27. Sly says:

    Lack of “}”. Check carefully your edited plugin.

  28. Mikael Hugo says:

    If you get it to work it would be nice that you post the entire code.

  29. theChad says:

    Here is the full code. The final issue I had was incorrect single quotes around the .php file names.
    I took the liberty of updating the version number and the links.

  30. theChad says:

    hmm… i guess the tags don’t work.

  31. Mikki says:

    Can you post it somewhere else?

  32. Jeremy Stein says:

    If you get this error:

    Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’

    It’s because you have an older version of PHP. You can fix it by removing “public static” from the code.

  33. Mikki says:

    My problem is that I get a redirect indefinatley.

  34. Croila says:

    I get an indefinite redirect too, and I’m using WP 2.6, and PHP4.

    If anyone can help out here and let us know how to get this working, that would be really great!

  35. Mikki says:

    @Crolia – Make sure the ‘’s are not ´´

  36. Martyn says:

    Got the infinite redirect as well but on WP 2.6 and PHP5

  37. kraucrow says:

    Look at the ‘… There was a problem with it…
    The correct file that works with 2.6:
    http://marius.php.lt/project/wp-auth/wp-authenticate.php.txt

  38. Ed says:

    Hi

    Are you going to release a new version of this useful plugin? It’s not working for me on 2.6.2

  39. aaawww says:

    I’ve also added as non-auth condition the upload page of the new flash uploader, to make it work with 2.6.2

    if
    (!(!(strpos($_SERVER['PHP_SELF'], ‘wp-login.php’) === false) || !(strpos($_SERVER['PHP_SELF'], ‘wp-register.php’) === false) || !(strpos($_SERVER['PHP_SELF'], ‘async-upload.php’) === false)) ) {

    (i’ve had to reverse the demorgan done on the two original strpos)

  40. Олег says:

    Тема эта старая конечно , но прочитал с удовольствием :)

  41. David says:

    Am I blind?

    PLEASE HELP!

    I just can’t find the download-link for the plugin on this page!

  42. The plugin posts are being re-worked in our new site design. Please find all the publicly released plugins in my WordPress.org profile.

  43. WopsAtopy says:

    Действительно прикольный блог! Спасибо огромное и… разумеется, пишите еще!

  44. toz says:

    Hey kraucrow, could you add the flash uploader fix proposed by aaawww to your file?

  45. kraucrow says:

    Done it, thanks for the tip.
    The file is the same ant here's the short url for it:
    http://budurl.com/wpauth

  46. Здрасте

    Четвертый сон Веры Павловны – это не для Фрейда…

    увидимся

  47. трекбэк … информация скачана с данного сайта – ссылка …

  48. wedorepai says:

    У вас рідкісний сайт, таких в Інтернеті дуже мало.

  49. carauttessy says:

    Хелло всем
    Отличный блог, но маловато информации(

  50. BagWayday says:

    Привет
    Маловато комментариев, а тема то хорошая

  51. poetle says:

    Автор, пиши чаще – тебя читают!

  52. Soattally says:

    Да уж, толково написано.

  53. nargiz says:

    На каком хостинге работает ваш ресурс?

  54. Nisyspipisp says:

    Отличный пост – слов нет. Спасибо.

  55. BarInsora says:

    Думаю, многие будут не согласны

  56. ninsk says:

    Очень глубокая и позитивная статья, спасибо. Теперь буду почаще заглядывать к вам на блог.

  57. Hoiceacle says:

    Есть кое что интересное для меня))

  58. orovi says:

    Блин, ЗАЧЕТ! Полностью поддерживаю! Жаль, заметил, в преддверии наступающих новогодних праздников интернет несколько обеднел на посетителей и, соответственно, на хорошие идеи тоже, а тут такое! Уважаю. А я вот сижу в нете днями, друзья разом махнули новый год встречать за бугор, а я не смог из-за сессии

  59. otovik says:

    Я бы не сказал, используя такой подход и логику, можно к такому бреду прийти. Так что, не стоит, не стоит… А, вообще, спасибо, это реально интересно и есть над чем задуматься. Всех с наступающими праздниками и побольше светлых идей в НГ!!!!! 31-го зажжем!

  60. MAXuton says:

    Огромное спасибо за информацию, это действительно стоит иметь в виду, кстати, нигде не мог ничего толкового на эту тему в нете нарыть. Хотя в реале много раз сталкивался с тем, что не знал, как себя повести или что сказать, когда речь заходила о чем-нибудь подобном.

  61. anixl says:

    Полностью с Вами согласен, я давно уже пришёл к такому мнению.
    ПС: Всех с наступающим Новым Годом. Всем хороших подарков и побольше, а то меня так на прошлый новый год только не в качестве вирусов угораздило, так “удачно” одарили, что без компа мог остаться, если бы не помощь добрых людей опять же из интернета.

  62. Exocuoure says:

    Пост понравился, пишите еще, с удовольствием прочту.

  63. это прямо в точку!!! другими словами и не скажешь!

  64. Vioffneent says:

    Я в принципе, мало, что смыслю в этм посте, но постараюсь все таки понять.

  65. 5ка! Отличный пост!

  66. Спасибо. Прочитал с интересом. Блог в избранное занес=)

  67. EreseeCouri says:

    Мне нравятся Ваши посты, многие заставляют задуматься)

  68. poetle says:

    А что, мне понравилось. Спасибо!

  69. opendancarp says:

    Отличный пост – слов нет. Спасибо.

  70. Женя says:

    Да уж, хорошо написано

  71. Да уж, автор сайта действительно очень добрый и отзывчивый человек. Спасибо :)

  72. WILDLIFE says:

    Можно и по этому вопросу, ведь только в споре зарождается истина. :)

  73. Прикольно написано и читается взахлеб)) ТС – золото!!

  74. Прикольно написано и читается взахлеб!! Автор – вызывает только уважение..

  75. Прикольно написано и читается взахлеб!! Автор – молодец..

  76. Прикольно написано и читается взахлеб)) Постер – молодец))

  77. Прикольно написано и читается легко.. ТС – вызывает только уважение))

  78. Прикольно написано и читается на ура)) ТС – вызывает море положительных эмоций!!

  79. Masha says:

    А как бы мне подписаться на Вашу RSS? Не могу найти ссылку :( . Напишите на 54632два1 в ICQ или masha_golovanova в skype. В крайнем случае – используйте почту. Заранее спасибо всем неравнодушным.

  80. Adam says:

    Hi
    I'm having a bit of difficulty with the plugin, no matter what user details I use to log in i get redirected to the login page, i.e. when I login with the correct user/pass I am again prompted for user/pass.. Any help would be greatly appreciated.

    Plugin Code
    class wpAuthenticate
    {
    function check_auth_to_read()
    {
    if ( ( strpos($_SERVER['PHP_SELF'], 'wp-login.php')===false )
    && ( strpos($_SERVER['PHP_SELF'], 'wp-register.php')===false )
    && ( strpos($_SERVER['PHP_SELF'], 'async-upload.php')===false )
    )
    {
    if ( !is_user_logged_in() )
    {
    auth_redirect();
    }
    }
    }
    }

    add_filter('init', array('wpAuthenticate','check_auth_to_read'));

    I'm using WP 2.6.1 in dev but propose using ver 2.7

    Any advice would be greatly appreciated.

  81. Автор, сколько по времени этот текст писал? Очень любопытно….

Leave a Reply

Pings/Trackbacks

  1. [...] force WordPress to require a login, we used the Authenticate plugin.  So, the only real work we needed to do was to create a system that forces the user to use [...]