I have a new Wordpress plugin available: "ZenPhoto Single Sign-On"
plaintext: http://elbedesign.com/projects/zp_plus_wp/zenphoto-single-sign-on.phps
zipped: http://elbedesign.com/projects/zp_plus_wp/zenphoto-single-sign-on.zip
The plugin is hopefully pretty self-explanatory:
[list]
[]When you log in to Wordpress, you are auto-logged in to ZenPhoto.
[]When you log out of Wordpress, you are auto-logged out of ZenPhoto.
[]No changes are required to your ZenPhoto installation--the plugin is completely self-contained.
[]You can even log in and out of ZenPhoto separately from Wordpress if you wish (although logging in/out of Wordpress will override the login state of ZenPhoto)
[/list]
[b]How it works/what it does:[/b] When a user logs in to Wordpress, the plugin checks to see whether they are authorized to perform a certain capability, as defined by the user's role (Administrator, Author, etc.) by default, the plugin required that the user be able to "publish_posts" in order to be logged into ZenPhoto. You can easily change the required capability (configuration options can be changed directly in the plugin file)
[b]To configure and install this plugin:[/b] The plugin needs to know
[list]
[]Your ZenPhoto [i]username[/i]
[]Your ZenPhoto [i]password[/i]
[*]What capability must the Wordpress user have to get admin access to ZenPhoto? ('publish_posts' by default)
[/list]
Set these options in the top of the plugin file, then upload the file to your wp-plugins folder and activate the plugin.
I have only tested this plugin on my own installation so far, so there may be some scenarios that aren't covered. Reply in this thread with any questions/problems/suggestions and I will try to get them rolled in promptly.
Not sure if matters to you.. but I have a windows server and this plugin did not work. This was because I did not have sha1 available on my server and it is using md5. I went to line and changed sha1 to md5 and it worked after that. Hope that helps somebody else.
Nice work by the way I have been looking for an easy way to do this... Works great!!
Chili -- I hadn't thought of that. I borrowed the cookie code from this login hack, but that needlessly introduces a new dependency. Thanks for the report.
I updated the plugin to use md5. Download links above are still current.
This plugin (v.0.1.1) now has a home: http://elbedesign.com/projects/wp-plugin-zenphoto-single-sign-on/
and in shuffling things, new download links as well:
plaintext: http://elbedesign.com/files/zenphoto-single-sign-on.phps
zipped: http://elbedesign.com/files/zenphoto-single-sign-on.zip
sleary, you caught me . new webhost, borked site, etc etc. I'll check it out. I will probably only test against the most current ZP release - hope that works for you
sleary, I just tested my plugin against ZP 1.1.2 and WP 2.3.1, and it appeared to work correctly. The only behavior I see that seems odd is that logging out of ZP does not "take" (but logging out of WP does log you out of ZP as well).
Can you describe your install and what is not working for you? (full path to WP, full path to ZP, expected behavior, behavior you are seeing)
I am using WP 2.3.1 with the latest ZP trunk and couldn't get it to work either.
My process:
Log out of ZP
Login into WP
Go to my WP admin.php and I still get prompted for username/pass.
There have been some password changes in the trunk, the password is now hashed, perhaps that's the problem?
No, I am hashing the user/pwd:
my code: setcookie("zenphoto_auth", md5($zp_user.$zp_pass), time()+5184000, '/');
zp code: setcookie("zenphoto_auth", md5($user.$pass), time()+5184000, $cookiepath);
My plugin doesn't know the path to the ZP install, which is why ZP is having trouble unsetting the cookie that my plugin is setting.
As I mention, my install seems to work just fine (with the exception fo the logout bug, which I am working on). My Wordpress is at /zpwp/wordpress/ and my zenphoto is /zpwp/zenphoto/.
Sleary and aitf311: what is your path to ZP and path to WP? Are they in sibling folders? It would be very helpful to see what your cookie values look like to see where the problem is (I use the View Cookies Firefox Extension). Or if I can reproduce your install paths on my end I can try to reproduce the problem. feel free to email me with specifics or whatnot: jlb at elbedesign dot com. thanks for any help nailing down this problem...
I have a beta of version 0.2 of this plugin available here:
plaintext: http://elbedesign.com/projects/zp_plus_wp/zenphoto-single-sign-on.phps
zipped: http://elbedesign.com/projects/zp_plus_wp/zenphoto-single-sign-on.zip
Changes in 0.2b1:
[list]
[]Configuration no longer requires editing the plugin file. An admin sub-page controls all plugin features ("ZenPhoto" tab under "Options").
[]
Options are now stored in the WP "options" table using the standard "add_option"/"get_option" functions.
[]
A new option has been added to allow you to specify your ZenPhoto install path. This eliminates the problem of WP "guessing" that ZP is installed is the root of your site, which means that in some cases ZP's logout functionality would not work. If this option is set correctly, this problem no longer occurs.
[]
[b]Known Issue:[/b] ZP password is stored as plaintext in the WP database, due to the complexities of post-processing user options after the form is submitted and before the db is updated. Fixing this is on my to-do list, but it will not happen in this release
[/list]
As I said, this is a beta release of 0.2 because it does nothing to address the problems reported by sleary and aitf311 above, which I am unable to reproduce on either my local machine or my server. Bug reports or other issues are welcome: jlb at elbedesign dot com.
Sorry I've been out of touch all weekend. I tried the latest version (which still reports itself as 0.1.1 in WordPress's plugin list, btw) just for grins, but I'm still seeing the same thing as aitf311: log into WP, go to ZP Admin, get prompted for password. It accepts the ZP pass, but not the WP one.
Unlike you, I have ZenPhoto in a subdirectory of the WP site.
WP: /
ZP: /photos
Cookies are:
wordpresspass_foo
wordpressuser_foo
wordpress_test_cookie
PHPSESSID
... where "foo" is actually a long, messy string.
HTH.
ETA: forgot to mention -- ZP is 1.1.2, WP is 2.3.1.
Okay, I'm back, and I think everything is running smoothly again.
First, sorry for the delay -- damn holidays!
sleary, I replicated your setup with ZP in a subdirectory of the WP install, and I think I found the bug that was causing problems. Although my version of the plugin WAS reporting itself as 0.2b1 correctly, so I'm not sure if you had the latest version installed.
plaintext: http://elbedesign.com/projects/zp_plus_wp/zenphoto-single-sign-on.phps
zipped: http://elbedesign.com/projects/zp_plus_wp/zenphoto-single-sign-on.zip
This version should report itself as v0.2. If it doesn't, something strange is going on.
Give it a shot and let me know if it does not behave as promised.
Thanks for your patience.
misterbrandt: I have added this to our extensions page: http://www.zenphoto.org/2007/12/wordpress-plugins/
Any updates on this lately...I'd love to have a plugin like this that I can get working!
my cookies typically look exactly like - sleary's -
What i see happening is when i log into WP and then check my ZP page at /gallery i see the zenphoto_auth cookie there, but as soon as i refresh my page the cookie disappears.
am i missing something?
There haven't been any "updates" because there was no evidence of any problem since my last release. The most likely cause of breakage is not having the "path to zenphoto" set correctly. Beyond that, you may have found a new bug? I will try to investigate, but if I cannot duplicate, it is hard to resolve...
hi can u help me.. what wrong i get this error when im login in my wordpress
Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/zmus/public_html/blog/wp-content/plugins/zenphoto-single-sign-on.php on line 124
Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/zmus/public_html/blog/wp-content/plugins/zenphoto-single-sign-on.php on line 129
Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/zmus/public_html/blog/wp-content/plugins/zenphoto-single-sign-on.php on line 129
Warning: Cannot modify header information - headers already sent by (output started at /home/zmus/public_html/blog/wp-content/plugins/zenphoto-single-sign-on.php:124) in /home/zmus/public_html/blog/wp-content/plugins/zenphoto-single-sign-on.php on line 147
Warning: Cannot modify header information - headers already sent by (output started at /home/zmus/public_html/blog/wp-content/plugins/zenphoto-single-sign-on.php:124) in /home/zmus/public_html/blog/wp-includes/pluggable.php on line 694
im using wordpress 2.5.1 and zenphoto 1.1.7
thx