Member
Member
amory   2005-09-24, 20:48
#1

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

Developer
Developer
trisweb   2005-09-24, 22:01
#2

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.

Member
Member
amory   2005-09-24, 23:33
#3

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.

Member
Member
loudestnoise   2005-10-15, 03:51
#4

Yes, a WP plugin would be splendid!

Member
Member
genosypheus   2005-10-18, 05:18
#5

Thanks amory, it works!

Member
Member
dryan   2005-11-17, 08:12
#6

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.

Member
Member
amory   2005-11-18, 23:24
#7

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.

Member
Member
dryan   2005-11-20, 15:36
#8

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.

Member
Member
jinabolton   2005-11-20, 16:38
#9

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

Member
Member
amory   2005-11-23, 20:05
#10

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.

Member
Member
3stripe   2006-02-22, 18:12
#11

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.

Member
Member
fungifred   2006-02-22, 21:43
#12

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.

Member
Member
hip   2006-08-11, 17:44
#13

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

Member
Member
flick   2007-05-03, 23:52
#14

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

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.