WordPress.org

Ready to get started?Download WordPress

Forums

access denied page (38 posts)

  1. renet
    Member
    Posted 6 years ago #

    hi there!

    i'd like to use exactly this ( http://wordpress.org/extend/plugins/members-only ) plugin but with one difference: i don't want visitors to be redirected to the login-form but show an "access denied" page (with a specified content and title) to non-logged in users (like a usual wp-page - so they can still see the menu etc).

    is this possible, and how?

    thanks in advance :)
    renet

  2. hami
    Member
    Posted 6 years ago #

    Hi Renet,

    I will add this functionality to the next update, and allow you to specify what page a user that is not logged in is redirected to. In the mean time you can change these lines in the plugin and it will give the desired result.

    Line 39:
    $login_redirect = "/wp-login.php?redirect_to=";

    Change to:
    $login_redirect = "/access-denied-page-url";

    This would redirect the user to an access denied page you've created in your WordPress blog.

    Also make this change...
    Line 51:
    $redirection = $home.$login_redirect.$requested_page;

    Change to:
    $redirection = $home.$login_redirect;

    I'll get an updated version of the plugin with this functionality finished and released shortly.

    Hope that helps,

    / Hami

  3. hami
    Member
    Posted 6 years ago #

    Sorry - actually that won't work as it will cause a redirection loop.
    I'll try and work out how to do this.

    / Hami

  4. hami
    Member
    Posted 6 years ago #

    Ok - I've added this functionality to version 0.2 which I will release shortly, I just need to do a few bug tests first.

    / Hami

  5. hami
    Member
    Posted 6 years ago #

    All done and dusted - version 0.2 is released and should be able to do what you want it to do.

    / Hami

  6. renet
    Member
    Posted 6 years ago #

    now it doesn't work @ all.. ^^

    is allows to view whatever page i want even when i'm not logged in. either it doesn't redirect to the specified page... in both cases (specify page/login page) the following error appears on top of the blog (page content is still shown):

    Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/w008171f/***/***/wp-content/plugins/
    all-in-one-seo-pack/all_in_one_seo_pack.php:103) in /www/htdocs/w008171f/***/***/wp-includes/pluggable.php on line 341

    but thanks for your quick reply & work, anyway =)

    if you could fix this & add the following i'd be very glad:
    - put the login form on that specified page.
    - allow to require not a login but a specified password for the whole blog.
    - maybe you could add the options to the privacy settings instead of a seperated options-page?

  7. hami
    Member
    Posted 6 years ago #

    The error appears to be a some clash with the All In One SEO Pack plugin, I found that it interfears with some other plugins too.

    Does Members Only work if you disable the All In One SEO Pack plugin?

    Does version 0.1 have the same problem with the All In One SEO Pack plugin?

    I personally prefer the Headspace2 plugin from Urban Giraffe for SEO stuff.
    http://urbangiraffe.com/plugins/headspace2/

    Regarding the addtional features...

    To put the login form on that specified page, it's not something I will put into the plug as it can be done in the page template or with another plugin.
    http://wordpress.org/support/topic/89153?replies=4
    http://wordpress.org/support/topic/90853?replies=2

    Adding a password only feature rather than a login, is done very well by the WP-Passwords plugin, so again I won't be adding that feature.
    http://wordpress.org/extend/plugins/wp-password/

    I will have a look at adding the settings to the Privacy Options page in the next update and see if it will accept the addtional content and options.

    Thanks for the feedback,

    / Hami

  8. renet
    Member
    Posted 6 years ago #

    deactivating the seo pack plugin eliminated the old warning, but a now one came along:

    Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/w008171f/***/***/wp-content/themes/decayed-10/header.php:7) in /www/htdocs/w008171f/***/***/wp-includes/pluggable.php on line 341

    thanks for your plugin-suggestions, used the first sidebar login form. :) when will the next update be finished? hope i can help you somehow.

  9. hami
    Member
    Posted 6 years ago #

    Hey Renet,

    Sorry to hear you still having problems, did you try reverting back to Members Only 0.1 and see if that error is still there?

    I'm stuggling to recreate the error, even on WordPress 2.3 beta. I not entirely convinced it's my plugin that causing it.

    Can you try 0.1, as that one worked for you, and see if the error is still happening - if not it's something else that's causing it as you seem to be the only one I heard from that is having the problem.

    Let me know what happens with 0.1...

    / Hami

  10. renet
    Member
    Posted 6 years ago #

    no i've never tried to use this plugin. is doesn't work with version 0.1 either... i've also tried using the default skin, but it didn't change anything... hmh

    i've looked up the code on line 341 in pluggable.php - the code around that line looks like this:

    336	if ( $is_IIS ) {
    337		header("Refresh: 0;url=$location");
    338	} else {
    339		if ( php_sapi_name() != 'cgi-fcgi' )
    340			status_header($status); // This causes problems on IIS and some FastCGI setups
    341		header("Location: $location");
    342	}

    does this help you?

    edit » as i just realized, this error also occurs with another plugin so it might not be a problem of your plugin... but it's the wp-password plugin, that is doing something very similar to what your plugin does. so it as well might have something to do with both of your plugins...

  11. walterego
    Member
    Posted 6 years ago #

    Hey Hami, I've tried your plugin as well with WP 2.2. It's not working here as well. Even when I'm not logged in I can access the website, and I'm getting an error too:

    Warning: Cannot modify header information - headers already sent by (output started at F:\WebDev\wamp\www\ukjl\wp-content\themes\pop-blue\page.php:4) in F:\WebDev\wamp\www\ukjl\wp-includes\pluggable.php on line 329

    It's the same error with the 0.1 and 0.2 version.

    If you need extra info just let me know. I want to use this plugin and need it to work before friday, so I'm more then happy to help.

  12. hami
    Member
    Posted 6 years ago #

    Hey Renet and Walterego,

    I think I may have tracked down the bug, it's something todo with using the header function in PHP and some using and echo before it. Both Members Only and WP-Password use header in order to work.

    Can you try this version of the plugin and see if it fixes the problem?
    Members Only 0.3

    If that doesn't fix it, can you send me a list of the plugins and themes your both using to labs@saruken.com? I'm curious to see if there is some overlap in what's going on in the header of the file.

    thanks,

    / Hami

  13. walterego
    Member
    Posted 6 years ago #

    Hey Hami, thnx for working on it! I´m getting this now:

    Warning: Cannot modify header information - headers already sent by (output started at F:\WebDev\wamp\www\wordpress\wp-content\themes\pop-blue\page.php:4) in F:\WebDev\wamp\www\wordpress\wp-content\plugins\members-only\members-only.php on line 74

    I'm using the pop blue theme, but I've modified it heavily. I'm only using page.php, if you want the code I'll send it to you (pastebin or something). The only plugin I'm using is Search pages.

  14. hami
    Member
    Posted 6 years ago #

    Hey Walterego - can you mail me the theme, i'd be keen to see what's going on in the header file.

    I have another idea to solve this problem, though it's not quite as elegent.

    / Hami

  15. renet
    Member
    Posted 6 years ago #

    sent you an email as well...

    i found an interesting discussion about that topic:
    http://wordpress.org/support/topic/111833

    but there seems to be no real solution... it seems to depent on the way the .php files are coded in some way... (ansi,unicode,utf-8) because different coding, different error messages (utf-8 & ansi, unicode doesn't work at all, i tried it with wp-password.php)

  16. walterego
    Member
    Posted 6 years ago #

    Hey guys,

    There's a plugin called Registerd Only that does the job perfectly. It lacks functionalities the members only is supposed to have, but it works if all you want to is block visitors who aren't registered.

    Hami, maybe you can use this to develop your own plugin?

  17. renet
    Member
    Posted 6 years ago #

    hey hami,

    have you found a solution for this issue? it'd be nice if you'd post it in here so i can try to fix it for the other plugin(s), too.

    thx
    renet

  18. hami
    Member
    Posted 6 years ago #

    Hey Renet and Walterego,

    Sorry for the slow progress, I'm without Internet at home at the moment as I'm moving house. I've had a look at the Registered Only plugin (well found Walter) and I see the funciton is being called at 'init' instead of 'wp_head' where I was calling it.

    I've made the modifications to Members Only so can you try this new version and see if it fixes your problem?

    Members Only 0.3

    Thanks for send those mails by the way, I couldn't see anything obviously glaringly being the problem - let's see if calling the function at 'init' fixes things.

    / Hami

  19. walterego
    Member
    Posted 6 years ago #

    Hey Hami,

    I haven´t really tested this version thoroughly, what I did is: activate -> check if members only is toggled -> log out -> go to blog's main page.

    Now, I didn't get the error this time, but I could view my website as I could before the members only plugin.

    So, errors are fixed, the plugin just doesn't do anything. Registered only still works.

    off topic: being without internet is one of the reasons why moving sucks. it just never rolls smoothly.

  20. renet
    Member
    Posted 6 years ago #

    it's the same with my blog... doesn't prevent non-registeres and logged in visitors from viewing the entries...

  21. hami
    Member
    Posted 6 years ago #

    Hey Walterego and Renet,

    Sorry about that, I wasn't getting that error on my WordPress installs even on 2.3RC1. I changed the way that the plugin found out if the user was logged in with that version by using the cookie - I guess it didn't work.

    Can you try this version, as I've changed it back to checking against the current User ID.
    Members Only 0.3

    Off Topic: Internet got turned on last night!

    / Hami

  22. walterego
    Member
    Posted 6 years ago #

    :(

    Still the same... No errors too though...

  23. hami
    Member
    Posted 6 years ago #

    Ok let's try this one...
    Members Only 0.3

    I changed the redirect back to a header call instead of wp_redirect and changed where I'm checking to see if the blog is Members Only

    Hopefully this one might work, I just can't get the errors your having - all of those past versions are working just fine for me.

    / Hami

  24. renet
    Member
    Posted 6 years ago #

    yesss this works for me, thanks a lot, fine work though you didn't get the errors ^^

    next time i would have tried upgrading to 2.3 - maybe i'll do that anyway ^^

    um 2 little things: access to /wp-admin/*, /wp-login.php* and to /wp-register.php* (etc.?) should be allowed for non-registered users as well! ;) because i use the defined page to display to non-registered users...

    another thing: how can i implement a "redirect_to" to a wp-page? is that possible? because i use a sidebar-login form. after logging in i'm redirected to the specified "access denied" page... hmh this should be thought over a little more i think this is not that easy to implement...

    another thing would be: how about adding the functionality of adding paged that are allowed for all visitors? wp-password has implemented this quite well in an inofficial alpha version. if you want to, i can send it to you.

  25. hami
    Member
    Posted 6 years ago #

    Great glad it's fixed - it's so hard to debug something when you can' t recreate the problem.

    You should be able to access /wp-login.php* but I did forgot to specifically add /wp-register.php, so if your using a custom login page you won't be able to get to it. I'll add that as a specific page you can get to.

    I'm not sure your about /wp-admin/* though - what would you want a user that isn't logged in to get to in there? By default you can't get in there anyway with out being logged in. The only thing I could think would be /wp-admin/upgrade.php

    On the redirect, that's a function of wp-login.php so unless you can add it to your login form on the sidebar, I don't think this plugin would be able to help.

    The other feature your after is a page that non-logged in user can access other than the login page? I'll look at adding a way of excluding some pages from the redirection.

    I'm working on the bigger brother of Members Only called Eyes Only that allows you to restrict individual page and post access based on the user's role otherwise you will be redirected to the login page.

    / Hami

  26. walterego
    Member
    Posted 6 years ago #

    Works! Thnx Hami!

  27. renet
    Member
    Posted 6 years ago #

    right, /wp-login.php works, sorry.

    if a user isn't logged in, he automatically gets redireted to the wp-login page, if he tries to visit /wp-admin/*. so why should this be protected?

    i use the live search popup plugin. if a user is not logged in he cannot live-search my blog entries, because the plugin tries to access /wp-content/plugins/.../....php. so it'd be nice, if one could not only specify pages and posts that are accessable, but also any possible file/folder. :)

    i've already implemented the redirect function to the sidebar login form. but when your plugin redirects a user to the specified "access denied" page, it's not possible for me to find out what page he wanted to see...

    do me a favour and make "eyes only" work for user-level restricted pages even without changing them to private status. because there are already a few plugins that do this job... ;)

    regards
    renet

  28. renet
    Member
    Posted 6 years ago #

    i just realized that when i start my webbrowser the first time i try to access my weblog, it is not protected. as soon as i refresh the blog or go to another page on my blog, the protectin is working. until the next browser restart...

    i'll set up a wp test installation and give you admin and ftp access so you can try out to fix this, if it doesn't appear on your installation...

  29. renet
    Member
    Posted 6 years ago #

    hmh @home it works even when trying the first time after starting my browser. at university it doesn't, as though i've installed the same browser versions (firefox 2.0.0.7). weird...

  30. walterego
    Member
    Posted 6 years ago #

    That's superweird, because php is serversided and browsers don't matter. Are you sure renet? Doesn't it maybe have something to do with cache?

Topic Closed

This topic has been closed to new replies.

About this Topic