Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Wordpress 1.5 - Restricting Single Posts, Without having to enter a password for each post
dodgerblue
post May 9 2005, 06:41 PM
Post #1


Super Member
*********

Group: Members
Posts: 270
Joined: 11-April 05
From: 10 inches from the computer screen
Member No.: 5,518



This is a mini tutorial on how to tweak WordPress 1.5 so that anonymous readers or registered users below a certain level (set by you) cannot view posts that you want to hide from them.

They won't even know that the posts exist.

This is assuming that either
1. you are running a blog/site that is meant to be administered by only one person (ie, you).
OR 2. you want to let some people co-author with you, but still need some posts to be restricted (more of a bloggers' privacy issue).

First Step: Download the Post Levels Plugin from http://fortes.com/projects/wordpress/postlevels

Second Step: Extract it somewhere and install it into your blog's wp-content/plugins folder.

Third Step: Go to your blog dashboard's Site Admin > Users > Authors & Users interface.

Here you will see a list of Authors and registered Users.

If you are familiar with WP, you will know that the list of people under Users are those that have registered. The default level for Users is 0.

This plugin works (as outlined in the documentation/readme) by entering "post_level" as the password for each post you wish to restrict by user level.

You will have to promote the users that you want to see the restricted post.

If you want only registered users to view certain posts, then promoting all to level 1 will suffice.

If you want different groups of registered users to view different restricted posts - for example, you want Peter to view Post A and B but Jane to view only Post A, then promote Peter to level 2, and Jane to level 1, and so on.

However, installing this plugin and using it straight off alone is kind of dangerous if your blog/site is meant to be administered only by you, as the default user level for enabling editing of posts, pages and links is 1.

After promoting you can see that all users with a level higher than 0 are automatically transferred to the Authors section.

You must therefore change the edit level value manually.

Fourth Step: You must edit the menu.php file located in the wp-admin folder of your blog/site.

Edit only the number in the round brackets " ( " and " ) ".

For example, this line - $menu[5] = array(__('Write'), 5, 'post.php');

Edit the highlighted number. This will correspond with the level of the user. Ie, 5 means that only users with level 5 and above can post.

This is a sample of what mine looks like after editing:

CODE
$menu[0] = array(__('Dashboard'), 0, 'index.php');
$menu[5] = array(__('Write'), 5, 'post.php');
$menu[10] = array(__('Manage'), 5, 'edit.php');
$menu[20] = array(__('Links'), 5, 'link-manager.php');
$menu[25] = array(__('Presentation'), 8, 'themes.php');
$menu[30] = array(__('Plugins'), 8, 'plugins.php');
$menu[35] = array(__('Users'), 0, 'profile.php');
$menu[40] = array(__('Options'), 5, 'options-general.php');


and

CODE
$submenu['post.php'][5] = array(__('Write Post'), 6, 'post.php');
$submenu['post.php'][10] = array(__('Write Page'), 6, 'page-new.php');

$submenu['edit.php'][5] = array(__('Posts'), 6, 'edit.php');
$submenu['edit.php'][10] = array(__('Pages'), 6, 'edit-pages.php');
$submenu['edit.php'][15] = array(__('Categories'), 6, 'categories.php');
$submenu['edit.php'][20] = array(__('Comments'), 6, 'edit-comments.php');
$awaiting_mod = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'");
$submenu['edit.php'][25] = array(sprintf(__("Awaiting Moderation (%s)"), $awaiting_mod), 1, 'moderation.php');
$submenu['edit.php'][30] = array(__('Files'), 8, 'templates.php');

$submenu['link-manager.php'][5] = array(__('Manage Links'), 5, 'link-manager.php');
$submenu['link-manager.php'][10] = array(__('Add Link'), 5, 'link-add.php');
$submenu['link-manager.php'][15] = array(__('Link Categories'), 5, 'link-categories.php');
$submenu['link-manager.php'][20] = array(__('Import Links'), 5, 'link-import.php');

$submenu['profile.php'][5] = array(__('Your Profile'), 0, 'profile.php');
$submenu['profile.php'][10] = array(__('Authors & Users'), 5, 'users.php');

$submenu['options-general.php'][5] = array(__('General'), 6, 'options-general.php');
$submenu['options-general.php'][10] = array(__('Writing'), 6, 'options-writing.php');
$submenu['options-general.php'][15] = array(__('Reading'), 6, 'options-reading.php');
$submenu['options-general.php'][20] = array(__('Discussion'), 6, 'options-discussion.php');
$submenu['options-general.php'][25] = array(__('Permalinks'), 6, 'options-permalink.php');
$submenu['options-general.php'][30] = array(__('Miscellaneous'), 6, 'options-misc.php');


This effectively tells WP not to allow users below level 5 to edit anything except their own profiles, and users with level 6 and above can post and edit entries, pages and links, and users with level 8 and above can install and edit themes and plugins.

Hope this helped somewhat.. smile.gif I'm available by IM and PM, as always.

Cheers!
Go to the top of the page
 
+Quote Post
dodgerblue
post May 12 2005, 10:24 AM
Post #2


Super Member
*********

Group: Members
Posts: 270
Joined: 11-April 05
From: 10 inches from the computer screen
Member No.: 5,518



IMPORTANT UPDATE:

This will NOT work with the newest version of WordPress (which is 1.5.1).

It is recommended to update your WP as there are critical security fixes in 1.5.1

If you've modified the menu.php file, it will be OVERWRITTEN during upgrade.

Please remember to DEACTIVATE this plugin BEFORE you upgrade or it could mess up your entire installation.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. **** Read Before You Post! ****(47)
  2. Halo 2 Glitches(48)
  3. The Most Annoying Website(57)
  4. Making Winrar Archives(12)
  5. What Is Mysql's Default Root Password?(8)
  6. Where In The World Are You From?(81)
  7. Get Paid To Post On Forums?(17)
  8. Computer Admin Login With Lost Password?(15)
  9. What Movies Are You Waiting For(33)
  10. Change Your Computer Password(6)
  11. Post Your Favorite Easy To Make Meal.(16)
  12. Simple Javascript And Password System(6)
  13. Post Some Wierd Experiences At Night You've Had In Here.(2)
  14. Trap17 Dynamic Recent Post/topic Image(17)
  15. Artistic?(3)
  1. Registration Form?!(6)
  2. Gahhh This Isn't Going Well Please Help!(12)
  3. Posts To Mailing List Are Blocked(1)
  4. My Minimalist Wordpress Theme(2)
  5. How Do I Find My Mysql Password? [resolved](5)
  6. Password Reset [resolved](2)
  7. Wordpress Upgrade Notification(3)
  8. How To Make A View New Post Script?(5)
  9. Post Your Banners Here(1)
  10. My Thoughts On Few Browsers(2)
  11. Wordpress Categories Disappear(3)
  12. Trap17's 400000th Post Giveaway!(12)
  13. How Do Uninstall Deep Freezer If I Lost Password?..(2)


 



- Lo-Fi Version Time is now: 25th July 2008 - 12:40 PM