WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Access Control
[resolved] Admin pages redirecting when "Only accessible by members?&qu (5 posts)

  1. evlapix
    Member
    Posted 3 years ago #

    If "Only accessible by members?" selected with a "Only Accessible By" role without "Administrator" checked, the Pages/Posts listing will redirect to the root URL.

    This happens because the WordPress Access Control Plugin hooks to the 'wp' action and validates all of the Pages/Posts returned against their permission settings. If an entry has an "Only Accessible By" setting, that doesn't include the Administrator, you will be subject to the same behavior as other unqualified users.

    I could be wrong. First day using WordPress beyond theming. It seems as though a simple solution would be to set the Administrator option to disabled:
    <input disabled="disabled" checked="checked" type="checkbox" value="administrator" name="wpac_restricted_to[]">

    Another option which I won't have time to investigate, might be to hook to another action not used on the the administration side of the site. Instead of:

    add_action( 'wp', array( 'WordPressAccessControl', 'check_for_members_only' ) );
    add_action( 'wp', array( 'WordPressAccessControl', 'check_for_nonmembers_only' ) );

    Great plugin otherwise. Does exactly what the user would expect.

    http://wordpress.org/extend/plugins/wordpress-access-control/

  2. evlapix
    Member
    Posted 3 years ago #

    "disabling" and "checking" the Administrator option forces Administrator only privileges. Another method will have to be found. Otherwise the plugin defaults to "All Members".

  3. itpixie
    Member
    Posted 3 years ago #

    I ran into the same problem described by evlapix. I activated "Only accessible by members" for a page and didn't give "Administrator" access by accident, then every time I tried to go to Page List from Dashboard, I was redirected back to Dashboard (i.e. denied access to Page List).

    Somehow I was able to access the pages via the website itself (via "Edit Post" on the website), but I could only access the ones "Administrator" had access. That one page that "Administrator" didn't have access, I was redirected to the login page.

    evlapix's quick fix code works nicely, even though I had to work it into meta_box.php so it looks seamless... Thanks evlapix for the quick fix.

    And like evlapix said, the plugin is great otherwise, I especially like that it's PHP 4 compatible -- very helpful when you're forced to use PHP 4.

  4. itpixie
    Member
    Posted 3 years ago #

    p.s. Disabling the plugin allowed me to regain access to Page List from Dashboard, but once the plugin was disabled, I had no way to give "Administrator" access to the problem page without the plugin activated... My only option was to delete the problem page. That's what prompted me to investigate evlapix's code - to avoid "Administrator" denied access to any page by accident.

  5. Brandon Wamboldt
    Member
    Plugin Author

    Posted 3 years ago #

    I've fixed this issue by using is_admin() checks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic