How do I: password protect a directory or files within using WordPress
-
Hi,
Looking for some advice here please. I am new to WordPress but have it up and running well and looking good(ish).
But what I need to do is create a directory containing files that only logged in users have access to. I am currently using .htaccess for this but this is clumsy and involves the users logging into WordPress to blog and comment and then log in again to the .htaccess area to view the pdf’s we have stored.
Ultimately I would like to be able to give access based on the user level, ie. if they are level 7 or below then they get access to the Board of Directors area, if they are above this level and a normal user then they can only gain access to the normal private areas. I have existing code on my pages to detect what level users are and allow or decline them access to pages and posts, but can’t see a way of doing this with directories or files.
Best case would the that there is a Plugin that would allow me to do this, but I was wondering if I could hack it so that every time a new user was created it would write that <user>:<pass> info into the .htaccess password file but that seems a bit of a round about way of doing it.
Unfortunately (or not as the case may be) I will not be running the site and the user in charge will not be able to get his head around editing the .htaccess password manually every time he adds a new user.Does anyone have any suggestions, workarounds or solutions to this?
many thanks.
- The topic ‘How do I: password protect a directory or files within using WordPress’ is closed to new replies.