Add to Google

Wordpress 1.5 - Restricting Single Posts - Without having to enter a password for each post

free web hosting
Open Discussion > CONTRIBUTE > Tutorials

Wordpress 1.5 - Restricting Single Posts - Without having to enter a password for each post

dodgerblue
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!

 

 

 


Reply

dodgerblue
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.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

Recent Queries:-
  1. wordpress "menu[35]" - 41.17 hr back. (1)
  2. wordpress post_level - 555.19 hr back. (2)
  3. adding rar files to wordpress tutorial - 791.74 hr back. (1)
  4. wordpress "privatefiles" - 1051.95 hr back. (1)
  5. wordpress password-protecting by user-level - 1593.58 hr back. (1)
Similar Topics

Keywords : wordpress, 1, 5, restricting, single, posts, enter, password, post

  1. How To Remember Complex Passwords
    Use the BEST password system ever! (14)
  2. Make A Moderately-secure Password System Using Javascript
    using file redirection to hide the password. (10)
    JavaScript is very handy at making forms, allowing for much more customization and easier ways to
    send data. So making Login forms using JavaScript may seem to many to be a very feasable idea.
    However, JavaScript is very bad at protecting Passwords, as since the passwords are not encypted and
    the whole JavaScript code is in the page, a person could just view the Page Source and find out
    everything. Even if you use an external JavaScript, it would still be poor as the file name for the
    external JavaScript would still be revealed. But I have an answer! There is a relative....
  3. Simple Javascript And Password System
    How to protect your pages with password (9)
    The quickest way to get a password protection system up and running is to use a Prompt box in
    JavaScript that has a title like "Enter your Email Address". Only you and the relevant users know
    what the password should be, could even be one each, that can be sorted out at the next page then
    pass the "input" directly through the url by changing the .href, like
    http://www.iSource.net.nz/users/?leTmeIn= The page that then processes this should also check for
    the referring page, and three fails from an IP if you like the php (the next page): CODE //
    processdownloads.p....
  4. Change Your Computer Password
    Change Your Computer Password (6)
    This Topic will teach how can you change your without knowing your old Passward 1. Click "Start"
    Then Click "Run". 2. In the dialog box type in "CMD" and select "OK". (Opens Command Prompt) Or you
    can manually open CMD by navigating to "C:\WINDOWS\system32\cmd.exe". 3. Once Command Prompt is
    open, type in "net user" and hit enter. This will display all user accounts. 4. Now type in the
    following command: " net user (ACCOUNTNAME) * " and hit enter Example: net user Trap * (Dont
    forget to add the asterisk) 5. Now it will ask for a new password, enter a password and....
  5. Wordpress Contact Form That Work With Free Web Hosts
    (1)
    Hi there, I had a bit of trouble setting up the wp-contact-form plugin for my wordpress blog that
    was hosted by freehostia. At first I was using the free package, so I couldn't send out any
    mail. I solved that by saving all messages to a directory, and password protecting it. When I
    updated to a payed package, I still couldn't send out any mail. It turned out that the From
    header had to be an existing email that I had registered with my freehostia account, and
    wp-contact-form used "From: " I solved that by modifying the plugin, changing From to the
    administrat....
  6. How To Set A Password In Bios
    the password is asked during start up (2)
    first let me tell you what is setting a password in bios is the password set at bios is asked when
    you start your pc even before your operating system is booted heres the steps 1.as soon as you start
    your pc press 'del' or 'Esc' continiously and you'll find the bios screen
    2.when you spot the bios screen go to the security section in security section there are two option
    of setting password 1.admin pass - you can't del this pass in bios without knowing the
    password(only for advanced users) 2.user pass - you can delete bthis password from bios ev....
  7. Embedding Videoclips Into Pbpbb/nuke Forum Posts
    (0)
    This is something i've been playing around with today, & the result is pretty good. If you want
    to give your members something to do, place some music videos/any videos/.swf files into posts on
    your forum. By incorporating a poll they can vote on them aswell. First, in the admin
    menu/configuration, find 'Allowed HTML tags' & make sure it shows the following:
    b,i,u,pre,embed,object,param name,value, An excellent source of practically unlimited free
    material can be found at youtube.com & they are even kind enough to give you the code to embed the
    videos.....
  8. How To Protect A Directory From Being Viewed
    without admin username and password (4)
    Well i ran across this script awhile back, and i am tired of storing it on my computer, so i am
    going to post it here and whenever i need it i will come here and get it /biggrin.gif"
    style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> hopefully Anyways, it is a
    verry simple process just copy and paste this QUOTE if (($user) && ($passwort)) { # get url
    $url = $DOCUMENT_ROOT . dirname($PHP_SELF) . "/.htpasswd"; # make .htaccess and .htpasswd
    $htaccess_txt = "AuthType Basic" . "\n"; $htaccess_txt .= "AuthName \"protected area\"" . ....
  9. Unencrypted But Invisible File Storage
    It can have a password, it can be unlocked. (0)
    This method works, but unfortunately compression software can open the file without the password.
    Also, you can try creating a new user account. When it asks "Make files and folders private?" click
    Yes, make private. Name the new user account anything using NO spaces/uppercase letters, but not
    something like "privatefiles" or something like that. Try accessing the files in C:\Documents and
    Settings\ >. You cannot open the folder. Now to ensure that user is always hidden in My Computer,
    click Start > Run. 1. Type in command.com . This should bring up a black window t....
  10. Get Rid Of Password Expiry
    Windows xp (6)
    In this tut i'm going to tell u how to remove the psswd expiry in windows xp * Go to Start|Run
    and type Control userpasswords2 * Go to Advanced tab in the user accounts window * Again select
    the Advanced button under the Advanced user management header. * Now click on the User in the Local
    Users and Groups. * On the right pane you will see the list of all user account * Right click on
    the user name for which you want to change the setting and select the Properties option. *
    Now click in the General tab check on the password never expires option. * Clic....
  11. Making Winrar Archives
    and adding password to winrar archives (13)
    **** This tutorial will show you how to put files into .rar Archive and pass worded (if wanted)
    **** What You Will Need Before continuing you will need a couple of thing, first of all you
    need WINRAR , which is a very powerful archive manager. It can reduce size for you email
    attachments, decompress RAR, ZIP and other types of files downloaded from the internet. You can get
    winrar at http://www.rarlabs.com The other thing is that make sure your using Windows XP because
    this is what I used to make this tutorial. I think it works with any other windows not....
  12. [php]password Protect W/o Db
    A good php tutorial (13)
    Hello all, I found this script actually on another website. But I modded it and added some things.
    Heres the code and stuff. Open a new file in your text editor and paste in this code. CODE {
    echo ' Username: Password: '; } ?> Name this file login.php Now open another
    new file in your text editor and paste in this code. CODE // Change 'YourUsername' to
    whatever you want. if ($_POST == "YourUsername") { // Change 'YourURL' to the directory to
    forward to. echo " "; } else { header("Location: error.php"); } // Change ....


    1. wordpress \menu[35]\

      Looking for wordpress, 1, 5, restricting, single, posts, enter, password, post






*SIMILAR VIDEOS*
Searching Video's for wordpress, 1, 5, restricting, single, posts, enter, password, post

*MORE FROM TRAP17.COM*
advertisement



Wordpress 1.5 - Restricting Single Posts - Without having to enter a password for each post