Wordpress plugin: ZenPhoto Single Sign-On

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:
  • 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)
How it works/what it does: 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)

To configure and install this plugin: The plugin needs to know
  • Your ZenPhoto username
  • Your ZenPhoto password
  • What capability must the Wordpress user have to get admin access to ZenPhoto? ('publish_posts' by default)
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.

- Josh
«1

Comments

  • Thanks!
  • 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.
  • trisweb Administrator
    Yep, we've been using md5 for some time. All it a cookie of md5("user"."pass") at the correct path.

    Thanks for the plugin! It looks good!
  • Awesome plugin. I'm using it on three sites already. Thanks so much!
  • Hey, misterbrandt, I think your site blew up. :) Is the plugin still around? The version I have doesn't seem to be working with WP 2.3.
  • 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:
    • 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.

    • Known Issue: 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
    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.
  • acrylian Administrator, Developer
    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
  • hi, do you think you can add hashed password support into the plugin? Everything works as it should but, encryption would be nice if its added.
  • sorry for the double post but, it also doesn't work with wordpress 2.6.2

    does anyone know why?
  • Hi everyone,

    I am looking for someone to take over maintenance of this plugin, as I have clearly not been "keeping up" as well as I could be.

    I have been moving my sites from Wordpress to Chyrp, and redirecting my development efforts accordingly, to the point where I only have a single site still running Wordpress, and that site doesn't even integrate with ZenPhoto. I also have a new baby, so I have less free time than ever.

    If you are interested in inheriting the ZenPhoto Single Sign-on plugin, please post here or send an email to jlb /at/ elbedesign /dot/ com

    -Josh
  • Ok so, my friend had recently only got zenphoto and he liked the plugin so he took it and made it work for wordpress 2.3.3+, including 2.6.2 and probably even 2.7. He said that he won't take over the project or anything at all but, he updated the plugin anyway.

    What's different about this plugin from the original is that, all you need to do is upload and activate the plugin and you're done. There is however, no menus or tabs to find this plugin in wordpress, it just simply does its thing by using cookies.

    The only requirement is that you need to have the same username in both wordpress and zenphoto but, not the same passwords and it will just log you in automatically with you login in wordpress.

    Here is the link for it(label this as unofficial 0.3 I guess):
    http://www.mediafire.com/file/ixnmamyggyu/zenphotosinglelogin.php

    If its against the rules to put links of files from other locations or I needed consent first, please delete the link.
  • acrylian Administrator, Developer
    It's absolutly okay to post a link to an extension here. We will add it to our extensions section. I actually would like to suggest not to use one of these file sharing hosters because these are sometimes a little inconvenient. Since that file will be small we can surely host that on zenphoto.org, too. (if it's okay with our project leader..:-))
  • Is anybody out there using this plugin?
    I would love to do so, but unfortunately it doesn't work with WP2.6.5 and the recent ZenPhoto version. My dream is that each logged in Wordpress User has access to the ZenPhoto albums. No Wordpress Account - no ZenPhoto access...
    Does anyone have a clue and can give some advices?
    Thanks,
    stef
  • I wanted to use this plugin but couldn't get it working with WP2.7 and the most recent ZP. What about making a plug in that is like Bobrik's wordpress-bbpress-syncronization plugin? http://bobrik.name/code/wordpress/wordpress-bbpress-syncronization/
    I've been using this to integrate my bbpress and wordpress, and so far it's been great.
  • acrylian Administrator, Developer
    You are welcome to provide such a plugin.
  • altert Member
    I've modified plugin to include support for augmented has in zenphoto and now it works with wordpress 2.9.2/zenphoto 1.2.9

    http://www.altert.net/upload/zenphoto-single-sign-on.zip

    I'm not sure I can properly take over the project, as I have no expereince in writing wordpress plugins, but at least I will check it against next zenphoto version. If it tests ok, I think it's better to move it to extensions page - I've changed version to 0.3
  • acrylian Administrator, Developer
    Ok, let us know when you think it is ready, then we'll update the link on the extensions page.
  • altert Member
    I've tested it (only in one environment though - zenphoto in root directory, wordpress in subdirectory) and I think it's ready. There is one more addition - plugin activates small dashboard widget with link to zenphoto admin interface.
  • acrylian Administrator, Developer
    Ok, best would actually be if you create a page for that plugin where you documentate the changes and post possible updates. We don't add those details to the extensions page for our convenience regarding updating. Of course if you include a readme and that links does not change we can link directly, too.
Sign In or Register to comment.