• Hi – I’m dumb and upgraded to 2.1 without realizing that the Page Restriction plugin by James Asher is broken (https://17thdegree.com/archives/2005/07/01/wordPress-plugin-page-restriction/).

    According to the comments on this post James may be working on this, but in the meantime I really need it and was wondering if anyone has an idea of how to fix it.

    The only thing I can see that’s really wrong is that the admin page which allows you to select pages to restrict is showing up blank – the restriction itself that I had in place prior to the ugrade seems to be working. This is the code from the plugin which pulls from the db to populate the admin page:

    <?php
    if (isset($user_ID) && ('' != intval($user_ID))) {
    $posts = $wpdb->get_results("
    SELECT $wpdb->posts.*, $wpdb->users.user_level FROM $wpdb->posts
    INNER JOIN $wpdb->users ON ($wpdb->posts.post_author = $wpdb->users.ID)
    WHERE $wpdb->posts.post_status = 'static'
    AND ($wpdb->users.user_level < $user_level OR $wpdb->posts.post_author = $user_ID)
    ");
    } else {
    $posts = $wpdb->get_results("SELECT $wpdb->posts.* FROM $wpdb->posts WHERE post_status = 'static'");
    }
    if ($posts) {
    ?>

    I’ve been looking around for what’s changed in 2.1 but don’t see anything off the bat. Might be my eyesight. ?? Can anyone help?

    Thanks!

    Michelle

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter FriendlyWP

    (@mmcginnis)

    Thanks Moshu!!

    This is the fix for those running into missing content on the Page Restriction options page:

    Open page-restriction.php and replace all instances of

    $wpdb->posts.post_status = 'static'

    with

    $wpdb->posts.post_type = 'page'

    Your pages should now show up on the admin (Options) page.

    After replacing

    $wpdb->posts.post_status = ‘static’

    with

    $wpdb->posts.post_type = ‘page’

    and at line 85:
    post_status = ‘static’
    with
    post_type = ‘page’

    I get this Error on the static Page:


    WordPress Datenbank-Fehler: [Unknown column ‘restricted’ in ‘field list’]
    select restricted from wp_2posts where ID=2

    and I get this message in the Admin-> Page Restriction


    WordPress Datenbank-Fehler: [Unknown column ‘restricted’ in ‘field list’]
    update wp_2posts set restricted=0 where ID=1

    WordPress Datenbank-Fehler: [Unknown column ‘restricted’ in ‘field list’]
    update wp_2posts set restricted=1 where ID=2

    WordPress Datenbank-Fehler: [Unknown column ‘restricted’ in ‘field list’]
    update wp_2posts set restricted=0 where ID=3

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘page restriction plugin broken in 2.1’ is closed to new replies.