IPB

Welcome Guest ( Log In | Register )



Tags
This content has not been tagged yet
 
Reply to this topicStart new topic

Wordpress 1.5 - Restricting Single Posts

, Without having to enter a password for each post


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



Post #1 post May 9 2005, 06:41 PM
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
no avatar
Super Member
*********
Group: Members
Posts: 270
Joined: 11-April 05
From: 10 inches from the computer screen
Member No.: 5,518



Post #2 post May 12 2005, 10:24 AM
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

    Topic Title Replies Topic Starter Views Last Action
No new   40 OpaQue 3,880 18th December 2004 - 06:21 AM
Last post by: s243a
No new 21 templest 1,742 3rd September 2004 - 06:28 AM
Last post by: wassie
No New Posts   5 Assassin 511 28th July 2004 - 11:32 PM
Last post by: KooL
No New Posts   5 The Devils Playpen 1,234 13th July 2005 - 04:23 AM
Last post by: xwilson7x
No New Posts   12 psp-playstation 852 23rd September 2008 - 02:12 PM
Last post by: arnz
No new   30 stevey 2,054 16th August 2004 - 01:16 PM
Last post by: templest
No New Posts   4 odomike 360 15th August 2004 - 02:38 AM
Last post by: OpaQue
No new   24 wassie 1,323 24th August 2004 - 07:07 AM
Last post by: Triple X
No New Posts   6 wassie 548 30th August 2004 - 08:59 AM
Last post by: DataHead
No New Posts   11 wassie 868 17th September 2004 - 01:43 PM
Last post by: Spectre
No New Posts 5 googlue 407 19th October 2004 - 04:08 AM
Last post by: odomike
No New Posts   2 Sniper 317 16th October 2004 - 05:20 PM
Last post by: wassie
No New Posts   2 JaVe 631 17th October 2004 - 12:36 PM
Last post by: Spectre
No New Posts 0 nirvana43 597 7th July 2006 - 04:17 PM
Last post by: nirvana43
No New Posts 8 bthaxor 654 12th December 2007 - 08:10 AM
Last post by: serverph


 



RSS Open Discussion Time is now: 9th January 2009 - 02:39 AM