Force login from the WPG2 page

Raz0redge

Joined: 2003-02-01
Posts: 6
Posted: Tue, 2007-11-13 14:22

My gallery requires the viewer to login and with the older version of WPG2 and wp-gallery2.php, I made a manual link in the header that would either point to wp-gallery2.php if the user was logged in or point to "/wp-login.php?redirect_to=/wp-gallery2.php" if they weren't.

I would like to replicate this scheme with the latest WPG2 3.0.2 which uses a page to view the gallery. If a user who hasn't logged in clicks on the wpg2 page they get redirected back to the index page again.

Would I make a page template in WP to accomplish thing?

Thanks

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Tue, 2007-11-13 16:07

I think you'll have to add some code to the existing page template in wpg2template.inc. Basically do a check for logged-in user at the top. Something like

	if (is_page($wpg2_option['g2_embedpageid'] && "conditional check of logged-in user") ) {

I don't have time to track down the actual WP code for that conditional check right now, but it should be fairly straight forward.

Kirk
____________________________________
G2Image Documentation, G2Image Demo Page, My Family Website

 
Raz0redge

Joined: 2003-02-01
Posts: 6
Posted: Tue, 2007-11-13 18:03

Sweet..I was looking in that file..just had to add "&& is_user_logged_in()" and then added my redirection code and it works like a charm.

Thanks