[b]Tutorial: WordPress and ZenPhoto login integration[/b]
[i]If you log into WordPress successfully, then the changes below will automatically log you into ZenPhoto...[/i]
Add the following to wp-login.php (wordpress base directory) at the very begining of the file:
`require_once("zenphoto/zen/functions-db.php");
require_once("zenphoto/zen/auth_zp.php");`
before this line:
require( dirname(__FILE__) . '/wp-config.php' );
then go to around line 195, which reads do_action('wp_login', $user_login); and replace with the following:
`do_action('wp_login', $user_login);
setcookie("zenphoto_auth", sha1(admin.password), time()+5184000, WEBPATH);
$_zp_loggedin = true;
wp_redirect($redirect_to);
exit();`
Obviously the set cookie function needs you to input your username and password for ZenPhoto (unless of course you keep them at admin and password respectively)
Thanks, I was going to modify it but the edit link had already disappeared. If it was an extensive change to WordPress core files, I agree it would not be very practical or elegant, but since it is a trivial change it will do, at least for now. I can look into working it into a WP plugin though.
Yes, a WP plugin would be splendid!
Thanks amory, it works!
wouldn't this set this cookie to anyone who logs into your wordpress and thereby let them have full control of your gallery?
if you replace admin.password with $user_name.$user_pass wordpress will pass on each person's username and password into the cookie and the admin link will only show up for the person who's information matches the user/pw set in config.php.
Quote:Correct, the cookie for ZenPhoto is then set per each user login. Therefore any of the website's administrators, regardless of user level, will be able to add photos.
I wouldn't think this would be a good idea as anyone who registers for your site can add, delete, wreak havok. But to each his own. At least with both ways posted people have a choice.
Amory, I'd also love to see this as a plugin.
Quote:I wouldn't think this would be a good idea as anyone who registers for your site can add, delete, wreak havok. But to each his own. At least with both ways posted people have a choice.
The intention for my purpose was for EventPress, a concert/band/event management platform I'm working on of which will use multiple admin users. If the end user wanted to have a community of sorts on the website you could always add in an if/else for user level etc.. but for my purpose that seems redundent.
I had to change the code when I implemented this to the following.
do_action('wp_authenticate', array(&$user_login, &$user_pass));
setcookie("zenphoto_auth", sha1(historian.plunger), time()+5184000, WEBPATH);
$_zp_loggedin = true;
could just be a WP2 thing.
I've just posted a different approach at
http://www.zenphoto.org/support/topic.php?id=755#post-4165
Hope it helps (a bit).
Have a good day,
hip