WordPress.org

Support

Support » How-To and Troubleshooting » access denied page

access denied page

  • 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

Viewing 15 replies - 1 through 15 (of 37 total)
  • 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

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

    / Hami

    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

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

    / Hami

    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?

    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

    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.

    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

    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…

    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.

    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

    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.

    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

    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)

    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?

Viewing 15 replies - 1 through 15 (of 37 total)
  • The topic ‘access denied page’ is closed to new replies.
Skip to toolbar