ZenphotoCMS Forum
Tutorial: WordPress and ZenPhoto login integration - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: Tutorial: WordPress and ZenPhoto login integration (/thread-41.html)



Tutorial: WordPress and ZenPhoto login integration - amory - 2005-09-24

[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)




Tutorial: WordPress and ZenPhoto login integration - trisweb - 2005-09-24

Edited for code clarity. Yes, that should work, but it's not an ideal solution since it requires you change the WP code... oh well. Good job, thanks.




Tutorial: WordPress and ZenPhoto login integration - amory - 2005-09-24

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.




Tutorial: WordPress and ZenPhoto login integration - loudestnoise - 2005-10-15

Yes, a WP plugin would be splendid!




Tutorial: WordPress and ZenPhoto login integration - genosypheus - 2005-10-18

Thanks amory, it works!




Tutorial: WordPress and ZenPhoto login integration - dryan - 2005-11-17

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.




Tutorial: WordPress and ZenPhoto login integration - amory - 2005-11-18

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.




Tutorial: WordPress and ZenPhoto login integration - dryan - 2005-11-20

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.




Tutorial: WordPress and ZenPhoto login integration - jinabolton - 2005-11-20

Amory, I'd also love to see this as a plugin.




Tutorial: WordPress and ZenPhoto login integration - amory - 2005-11-23

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.




Tutorial: WordPress and ZenPhoto login integration - 3stripe - 2006-02-22

Any update on converting this to a plugin. I wouldn't use it unless it could be restricted to certain users, but would be a great addition.




Tutorial: WordPress and ZenPhoto login integration - fungifred - 2006-02-22

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.




Tutorial: WordPress and ZenPhoto login integration - hip - 2006-08-11

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




Tutorial: WordPress and ZenPhoto login integration - flick - 2007-05-03

Unfortunately I can't seem to get the code to work with Zenphoto 1.0.8.2 and WP 2.1.3...