It would be great to implement some form of Password Protect for albums or entire directory, not using .htaccess. A guy just released something of interest for Wordpress that is similar to what I am thinking of. http://broome.us/archives/2007/01/31/the-wordpress-password-plugin/
Regards...
I was just thinking about starting my own thread for this. I second this idea.
I would like to have albums I can share with say family members only who have a password.
pennylessz28-
I have the same situation as you, there are albums I would only like family to view.
If you don't need a 100% safe way of keeping others away from your family pics, it's rather easy to add a password to your theme. Simply use cookies in your album.php. If a cookies isn't set, show a form where you ask for the password. If the visitor has provided the correct password, you can set the cookie and send the code for generating the thumbnails.
This is an album without a password:
http://www.newwws.be/zenphoto/mieren
And this is an album with a password:
http://www.newwws.be/zenphoto/test (the password is [b]zen[/b])
I work with a theme that uses a configuration file for each album. In that configuration file I can select whether to use a password or not. The cookie is valid for 30 minutes. After that time people will have to re-enter the password again. If you want to see the form in action again and don't want to wait 30 minutes, you can change the toplevel domain of the links into .org / .net / .tv / .us / .co.uk / .be
groeten, Miriam
Miriam-
If it's not too much trouble, you should share your work with the forum here? It might benefit others, if it's something you can package up easily. I'd be happy to write up the wiki article and place it in the ZenphotoHacks portion of the wiki. There have been a number of people (especially in this thread) asking about something like this. I know that this is planned for eventual release in the core zenphoto code, but this might help "hold" people over until that feature is integrated in the code.
I'll give it a try. I had to change the code a bit because I don't think that I have the time to explain here how the newwws-theme works with its own configuration files. I also made the way the cookies are written a bit easier to understand for those people who have never used cookies before.
FIRST...
Place this PHP code BEFORE the line with in album.php
`
`
SECOND...
Place this code in a new PHP-file called newwws_password.php in the same folder as album.php
`
Excellent Miriam-
Thanks! Maybe those who had the request out there for this can give it a try and see how it works for them. Meantime, as I get a chance I'll post it to the wiki.
seems to work just fine miriam on my dev site. here: http://www.thinkdreams.com/devzen/index.php?album=_cayman1996
password is defaulted to "zen".
i'll put this up on the wiki for reference.
@Jayray999
Based on what I see in the code: yes.
Might be able to be tweaked a little, but I think that's what Miriam meant by Item #4: "Enhance this - I'm not a programmer"
@thinkdreams. Thanks for the reply.
@miriam. Is the newwws-theme that you use publicly available. You say that, "I work with a theme that uses a configuration file for each album." Maybe that enables you to set a unique password for each album. If so, please do add the theme to @thinkdreams growing collection of ZP themes. Thanks again and incidentally, you have a wonderful site.
Cool. I just came to check out the support forums and saw these [i]excellent[/i] replies.
[b]Thanks[/b] much for your insight! As soon as I am able I am going to test this out and will let you know how it goes.
Will be interesting to see if I can get this to work along with Zenpress plugin to link photo in a post to an album.
jayray999w wrote: "One question though: Does this mean all albums will have the same password?"
No, but you'll have to find yourself a way to set the variable $newwws_password to a unique value for every album. If $newwws_password is not empty, the user will be asked to enter the password stored in $newwws_password.
I adapted the code a bit so a default password will be asked for every album with a name that starts with an underscore.
The newwws theme is highly configurable. Without a configuration file it will show 18 thumbnails in 3 rows of 6 thumbnails and on a default background. With the configuration file you can change the number of thumbnails on each row, let's say 6-4-2 or 5-4-3. It's also possible to use a different background for every page in an album and by selecting another css and/or another script it is possible to change the way the thumbnails look.
Despite it is easy to work with the configuration files, it is also possible to work without. In that case the theme will use the default settings.
The newwws theme is far from ready and it will take some time before I will make it available to other people.
Groeten, Miriam
I am working on a zenphoto plugin that will allow you to create a password protected album from within the admin section. You'll be able to select whether an album is password protected and if so set a password.
I can't promise that it will be future compatible, but I will try my best to abstract as much of the code as possible which should help to make it compatible for future versions.
As soon as I have it done (I am working on it for a customer), I will share it here.
Just wanted to give everyone a heads up.
@tdevlin: This is excellent news. Thank you for doing this. I have a few suggestions for your consideration. Please ignore them if you already thought of these points.
I assume you will allow different passwords for diferent albums.
You may also want to consider allowing more than one password per album. Here is why. Supposing you want to show off a client album to another party. You can give them password access to the same client album (presumably with permission of your client) but only for a week. At the end of the week you disable the second password but your client's original password remains unchanged.
Best to store the passwords in a separate DB table so that if Tristan updates the usual DB tables your table will remain unaffected.
You must already have thought of this but obviously avoid changing the core Zenphoto files as far as possible. Better to add files to /zen and if necessary to add lines to existing files than to replace existing code within files. That is another way to keep it compatible with future versions.
Update:
My key goal was to create an album password protection mechanism that works with zenphoto without altering the core code, in fact I didn't want to touch the database either. The reason for this was to help prevent future releases from breaking functionality.
What I have accomplished so far:
All passwords for albums (those that are protected) are stored in a yaml file (you can read more about it here: http://www.yaml.org). This file contains the album->foldername and the password for that album. If the album->foldername is not located in the yaml file that album is not protected. Editing of the yaml file is done through an extension to the admin section. When editing an album, one new line of code is added there (again wanted minimal data changes for the core code) that when clicked will take you to a new_file that adds that album->foldername to the yaml file and allows you to type in a password for it. Or if there was already a password, allows you to change or delete it. My customer is currently testing it out for me and will let me know if there are any first round bugs in it. I am also cleaning the code a bit more so I can package it up easier.
Just wanted to send out an update on the progress.
Also, many thanks to miriam for the initial code posted, it helped give me the idea for not integrating it totally into zenphoto, but instead abstract much of it. Also, I ripped the login form from the example, I hate typing mundane HTML code out.
Hello, first, sorry for my english, i'm french so i'll probably do some mistakes in my message...
This add for Zenphoto looks great, I've read the "Password Protected Albums" article on ZenphotoHacks page but i don't understand where i must paste the source code on step third...
I'm using the steril theme , this is what my album.php looks like, can someone helps me ?
Thanks in advance !
|