The comments for this on the plugin author’s site mention this error, have you read those specific comments?
Unless you downloaded this from somewhere else, since the file on the author’s site differs from yours slightly — and the code changes are also suggested within other comments (note that those arent changes that necessarily fix your problem, I just noticed that the files are different).
Its bad form and unwise to download plugins if you’re not actually getting them from the person that wrote the plugin, btw, especially if you’re not familiar with PHP — you never know what you might end up
Thread Starter
immow
(@immow)
Without those changes the plugin would not show my pages that I could restrict.
I understand that — thats why I said what I said about the changes NOT being related to the issue in this post.
Since you have made those changes —
1. You took the changes off the comments on the authors site?
(Yes): Yes, you did, but you didnt read the _other_ comments.
(Yes): Yes, you did, AND you did read the _other_ comments and they didnt help.
(No): No you did not, so you are not aware of any comments. (this is where my remark about picking up plugins “any ole place” comes from)
See where I’m going with this?
Thread Starter
immow
(@immow)
After reading like 50 posts I manged to change the code so that it works.
Source can be found here of my working page restriction code: http://immow.nl/page_restriction.txt
If this page is dead then you can look at the comments at author site for the solution. I combined the following suggestions in comments from http://17thdegree.com/archives/2005/07/01/wordpress-plugin-page-restriction/:
####Part 1####
Line 81:
WHERE $wpdb->posts.post_type = ‘page’
Line 85:
$posts = $wpdb->get_results(“SELECT $wpdb->posts.* FROM $wpdb->posts WHERE post_type = ‘page'”);
Line 123:
$pages = $wpdb->get_results(“SELECT * FROM $wpdb->posts WHERE post_type = ‘page’ ORDER BY menu_order”);
Then my pages appear under Options > Page restriction and I’m able to select the pages that require a logged-in user. When that page is selected in the menu, user is immediately taken to the login screen.
####part 2####
You find this code at the bottom
add_action(‘wp_head’, ‘check_the_user’);
to
add_action(‘template_redirect’, ‘check_the_user’);
I like to thank whooami for pointing out the power of reading.
Thread Starter
immow
(@immow)
I like to add that a friend of mine claimed using opera it takes a long time to load the pages (I use a drop down menu theme) where one pages is restricted. Second strange thing is the plugin is gone from plugins in wordpress but I can still use the plugin-restriction admin pannel