WordPress Authentication Plugin
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”
Leave a Reply
Pings/Trackbacks
-
[...] 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 [...]
Thank you, that’s exactly the sort of plugin I’ve been looking for throughout the past days. It perfectly works.
where is the download?
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.
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
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.
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.
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.
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
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
If the code is showing up, make sure it’s wrapped in php tags:
< ?php ... ?>Other than that, what version of wordpress?
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.
Thank you for creating this plugin. FYI – I am using it successfully with Wordpress 2.5.
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.
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?
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.
So, this plugin doesn’t seem to work on 2.6. Any suggestions?
BTW- the problem seems to be that WP 6 changed how cookies work, it that helps point out the solution.
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() ) {
Should say “these two lines:”
Maybe I am blind but I can not see these two lines in the wp-authenticate.php .
Frederik, the change you suggested worked like a charm…
Thanks
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.
Thanks a lot bread. It’s working now
.
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?
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.
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 () {”
Lack of “}”. Check carefully your edited plugin.
If you get it to work it would be nice that you post the entire code.
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.
hmm… i guess the
tags don’t work.Can you post it somewhere else?
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.
My problem is that I get a redirect indefinatley.
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!
@Crolia – Make sure the ‘’s are not ´´
Got the infinite redirect as well but on WP 2.6 and PHP5
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
Hi
Are you going to release a new version of this useful plugin? It’s not working for me on 2.6.2
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)
Тема эта старая конечно , но прочитал с удовольствием
Am I blind?
PLEASE HELP!
I just can’t find the download-link for the plugin on this page!
The plugin posts are being re-worked in our new site design. Please find all the publicly released plugins in my WordPress.org profile.
Действительно прикольный блог! Спасибо огромное и… разумеется, пишите еще!
Hey kraucrow, could you add the flash uploader fix proposed by aaawww to your file?
Done it, thanks for the tip.
The file is the same ant here's the short url for it:
http://budurl.com/wpauth
Здрасте
Четвертый сон Веры Павловны – это не для Фрейда…
увидимся
трекбэк … информация скачана с данного сайта – ссылка …
У вас рідкісний сайт, таких в Інтернеті дуже мало.
Хелло всем
Отличный блог, но маловато информации(
Привет
Маловато комментариев, а тема то хорошая
Автор, пиши чаще – тебя читают!
Да уж, толково написано.
На каком хостинге работает ваш ресурс?
Отличный пост – слов нет. Спасибо.
Думаю, многие будут не согласны
Очень глубокая и позитивная статья, спасибо. Теперь буду почаще заглядывать к вам на блог.
Есть кое что интересное для меня))
Блин, ЗАЧЕТ! Полностью поддерживаю! Жаль, заметил, в преддверии наступающих новогодних праздников интернет несколько обеднел на посетителей и, соответственно, на хорошие идеи тоже, а тут такое! Уважаю. А я вот сижу в нете днями, друзья разом махнули новый год встречать за бугор, а я не смог из-за сессии
Я бы не сказал, используя такой подход и логику, можно к такому бреду прийти. Так что, не стоит, не стоит… А, вообще, спасибо, это реально интересно и есть над чем задуматься. Всех с наступающими праздниками и побольше светлых идей в НГ!!!!! 31-го зажжем!
Огромное спасибо за информацию, это действительно стоит иметь в виду, кстати, нигде не мог ничего толкового на эту тему в нете нарыть. Хотя в реале много раз сталкивался с тем, что не знал, как себя повести или что сказать, когда речь заходила о чем-нибудь подобном.
Полностью с Вами согласен, я давно уже пришёл к такому мнению.
ПС: Всех с наступающим Новым Годом. Всем хороших подарков и побольше, а то меня так на прошлый новый год только не в качестве вирусов угораздило, так “удачно” одарили, что без компа мог остаться, если бы не помощь добрых людей опять же из интернета.
Пост понравился, пишите еще, с удовольствием прочту.
это прямо в точку!!! другими словами и не скажешь!
Я в принципе, мало, что смыслю в этм посте, но постараюсь все таки понять.
5ка! Отличный пост!
Спасибо. Прочитал с интересом. Блог в избранное занес=)
Мне нравятся Ваши посты, многие заставляют задуматься)
А что, мне понравилось. Спасибо!
Отличный пост – слов нет. Спасибо.
Да уж, хорошо написано
Да уж, автор сайта действительно очень добрый и отзывчивый человек. Спасибо
Можно и по этому вопросу, ведь только в споре зарождается истина.
Прикольно написано и читается взахлеб)) ТС – золото!!
Прикольно написано и читается взахлеб!! Автор – вызывает только уважение..
Прикольно написано и читается взахлеб!! Автор – молодец..
Прикольно написано и читается взахлеб)) Постер – молодец))
Прикольно написано и читается легко.. ТС – вызывает только уважение))
Прикольно написано и читается на ура)) ТС – вызывает море положительных эмоций!!
Good Info..
А как бы мне подписаться на Вашу RSS? Не могу найти ссылку
. Напишите на 54632два1 в ICQ или masha_golovanova в skype. В крайнем случае – используйте почту. Заранее спасибо всем неравнодушным.
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.
Автор, сколько по времени этот текст писал? Очень любопытно….