I'm new to Zenphoto and would like to integrate/bridge it with my PunBB forum. Mostly what I've been able to find along the same lines deals with WordPress...and I just don't know enough about WordPress to sort things out.
Any answers, code snippets, or links are very much appreciated. I kind of envision developing this in stages...
INITIAL QUESTIONS/CONCERNS
It looks like ZenPhoto uses a md5 password hash, whereas PunBB uses a modified sha1 hash. Before I can get very far, I would need to coordinate these. So, short of hacking core files, is there a way to get ZenPhoto to read/store an alternate password hash instead of the default?
STAGE 1
I think a quick and dirty solution would be to create a database query that would import users from the PunBB database into ZenPhoto with some predetermined default rights. Actually, there are a couple of queries necessary because of the managed albums, so probably borrow heavily from saveAdmin() in functions.php to create a custom script.
The passwords still wouldn't match, so users/administrators would have to reset.
STAGE 2
For this stage, I think modify the script to better synch between the two databases. At this point administrators can only be ADDED, so check that when PunBB members have been removed that the corresponding Zenphoto administrator is also deleted. Perhaps assign more rights to Zenphoto administrators if they are promoted to moderators on the forum, etc.
The script at this point would still be stand-alone and would have to be run periodically.
STAGE 3
Convert the script to a Zenphoto plugin so that it can easily be run from within the administrator panel.
STAGE 4
More complete integration should ideally have these features:
* Usernames and passwords should bypass the Zenphoto database completely and authenticate against the forum database.
* Logging into the forum should log someone into Zenphoto, too, using cookies/sessions. Same with logging out.
* Changing an administrator's username, password, or email in the Zenphoto administration panel should update information in the forum database accordingly.
* I'm not sure exactly how to handle administrator deletions from Zenphoto... Probably delete them from the forum, too, but with a confirmation that this is what will happen.
* Integration should be accomplished fully as a plugin and should not require direct modification of core code.
* Plugin options should be available from the "plugin options" tab. I can envision several options, such as setting default rights for imported users...maybe even consider whether the forum user is a regular member, moderator, or administrator?
I welcome any feedback or help in moving this along. Thanks.
Comments
Stage 1: Sounds like a reasonable approach.
Stage 2: Ok, maybe you want to modify the PunBB script that creates moderators to also create the zenphoto one. Then even the password could be handled.
Stage 3: Why not just start out making the script an admin Utility. (See the nightly build.)
Stage 4: That's a lot of change to zenphoto. Unless you come up with a scheme to make this part of zenphoto replaceable (like the captcha and spam filters) you will be forever catching up to zenphoto changes. As to the probability of making it modular--since is is operating at some very primitive levels you are pretty much limited to replaceable PHP scripts. Options are unlikely to work since you have to log in before you can even set one. The initial zenphoto install would be a serious challenge if the login code is selected by an option.
A better solution might come from working the PunBB side since I think they have a pretty thorough hook system that will accomplish more of what I want. I need to look into it a bit further, but I think I can use these hooks to create an extension that would handle the following upon forum log in:
* Create a hash of the user-supplied password to match Zenphoto's scheme.
* Check if the forum user already exists as an administrator in Zenphoto. If so, update the zp_administrators datatable with the password hash. If not, add the user to the zp_administrators datatable with some predefined rights.
* Set an additional cookie for Zenphoto. (Unset upon forum log out.)
* Set an additional session for Zenphoto. (Unset upon forum log out.)
With this, the main pieces would be in place for integration. Not perfect, but workable.
Quaker(punbb)