Login

esieens

Joined: 2005-06-24
Posts: 65
Posted: Fri, 2007-10-19 06:42

Hello,

I have a gallery2 install on www.walnut-grove.co.uk/gallery2 that requires users to log-in to access the main album.

Can I still use the WPG2 plugin to display some pictures from my gallery2 to my blog? Or do I need to have at least one album viewable by all to do that?

Thanks,
David

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Fri, 2007-10-19 11:02

There are a couple of different ways to handle this.

Just to be sure I understand your question, do you want the G2 images to be publicly viewable in the blog entries? i.e., when users are not logged in? If so, yes, at least one album must be viewable by all. One good way to do that is to have a public album, and then create replicas from the private albums in the public album. That way, you only have one item stored in your filesystem to make changes to, but if you delete it from your public album, it's still in the private one.

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

 
esieens

Joined: 2005-06-24
Posts: 65
Posted: Fri, 2007-10-19 18:02

Thanks capt_kirk.

I don't want my family pictures to be viewable to all that's why you need to login to access any album in my gallery.

However I want to be able to include pictures coming from my gallery in a post on my blog from time to time.

I did think about having one public album but I was hoping that with this plugin I could avoit it by e.g. providing login/password details f my gallery to the WPG2 plugin so that it can connect to my gallery and access pictures directly when required.

Is having a public album my only option?

Hope it makes sense.
Thanks.

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Fri, 2007-10-19 18:18

That does make sense. Unfortunately, there's no way to do that with the current code. You'd have to hack the g2_login function in wpg2embed.inc to do that. If you're comfortable with PHP, it doesn't look like it would be that hard. I don't have time this weekend to take a crack at it, unfortunately. (Scouts, chauffeur for kids, etc...)

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

 
esieens

Joined: 2005-06-24
Posts: 65
Posted: Fri, 2007-10-19 18:29

ok thanks - I'm not that good with PHP unfortunately. ;)
Appreciate the time you took to respond.
have a nice week-end.

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Fri, 2007-10-19 18:45

I'll take a crack at it sometime. If I forget by the middle of next week, bump this post. (I have a task list for work, but not for WPG2/G2Image. That would make it too much like work. :) )

esieens wrote:
ok thanks - I'm not that good with PHP unfortunately. ;)
Appreciate the time you took to respond.
have a nice week-end.

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

 
esieens

Joined: 2005-06-24
Posts: 65
Posted: Mon, 2007-10-29 06:49

Hello - just checking if by any chance you had the time to look into it.
Thanks

 
ozgreg
ozgreg's picture

Joined: 2003-10-18
Posts: 1378
Posted: Mon, 2007-10-29 21:26

Actually the other way around this is to use the password protect plugin, and instead password protect your family albums.
____________________________________
Wordpress / Gallery2 (WPG2) Plugin, WPG2 Downloads, WPG2 Documentation

 
esieens

Joined: 2005-06-24
Posts: 65
Posted: Tue, 2007-10-30 05:57

I have already quite a few users with their own account... could I still make it work somehow using both permissions and password protection?

Thanks

 
ozgreg
ozgreg's picture

Joined: 2003-10-18
Posts: 1378
Posted: Tue, 2007-10-30 06:16

From the Item (Album) Password Protect Plugin..

"Password Protection

Assign a password that is required for guests or other users without view permission."

Hope this helps..
____________________________________
Wordpress / Gallery2 (WPG2) Plugin, WPG2 Downloads, WPG2 Documentation

 
esieens

Joined: 2005-06-24
Posts: 65
Posted: Tue, 2007-10-30 08:34

so does that mean i need to add guest access to all my family albums but add a password protection?
What would that mean for my registered users? Would they need the password as well?

Thanks

 
ozgreg
ozgreg's picture

Joined: 2003-10-18
Posts: 1378
Posted: Tue, 2007-10-30 22:15

You might want to try it for yourself as I do not have any experience with this Gallery2 module..
____________________________________
Wordpress / Gallery2 (WPG2) Plugin, WPG2 Downloads, WPG2 Documentation

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Wed, 2007-10-31 17:47

esieens,

Sorry for the delay. It was actually much easier than I thought it would be, once I really looked at the code.

1. Make a new WordPress user, something like gallery_viewer.

2. Note the ID that WordPress assigns to that user.

3. Make that WordPress user a "G2 User" under WP Admin -> Users -> Gallery2 Users.

4. Change line 83 of wpg2embed.inc (global $user_ID;) so that the part of the code that looked like this

function g2_login() {
	// Get WPG2 Option Settings
	$wpg2_option = get_option('wpg2_options');
	global $user_ID;

now looks like this

function g2_login() {
	// Get WPG2 Option Settings
	$wpg2_option = get_option('wpg2_options');
	$user_ID = 3;

where the "3" in the example is the user ID that you noted in step 2.

This will always use that fictional user to log into G2. You can set your G2 permissions around that user.

It also means that you'll have to do all of your G2 site admin in stand-alone mode, since you won't be able to get to site admin from any of your WP users' accounts.

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

 
esieens

Joined: 2005-06-24
Posts: 65
Posted: Mon, 2007-11-05 06:32

Thanks - i'll give it a try as soon as possible.

 
esieens

Joined: 2005-06-24
Posts: 65
Posted: Mon, 2007-11-05 07:07

I'm still not able to see my pictures, check:-
http://www.walnut-grove.co.uk/blog/?page_id=166

WPG2 validates fine.

I also tried to use the Image Chooser and I don't seem to be able to browse any sub-album. I can only see my top gallery but cannot expand it.

Any idea?

Thanks

 
esieens

Joined: 2005-06-24
Posts: 65
Posted: Mon, 2007-11-05 08:12

Got it working.

One last thing that I'm not sure about.

I have added a gridblock in the sidebar. When I click on the picture it goes to my gallery but somehow does not display the picture. Not sure why.

Anyway, I'd like to have a link but that goes to my gallery2 main page (so that use can properly log in) rather than a lin directly to the image. How could I achieve that?

Thanks

 
esieens

Joined: 2005-06-24
Posts: 65
Posted: Fri, 2007-11-09 19:12

I have had a look at the code - I cannot see where the link is being generated when the function to create the gridblock is called. I'd like to change that function so that no link is created (basically creating a randon image gridblock with no link).

Thanks.

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Fri, 2007-11-09 19:30
esieens wrote:
I have had a look at the code - I cannot see where the link is being generated when the function to create the gridblock is called. I'd like to change that function so that no link is created (basically creating a randon image gridblock with no link).

The link is created by G2's ImageBlock module (documentation on the actual API call), not directly by WPG2. There is not currently a way to generate the block without a link. When we get away from the ImageBlock module in WPG2 3.1, we'll be able to do that.

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

 
esieens

Joined: 2005-06-24
Posts: 65
Posted: Sat, 2007-11-10 07:09

ok thanks - any idea why the link being generated right now does not give me access to the picture but a blank page?

Anyway - Many thanks for your help it was much appreciated and I'm really pretty close to what I wanted to do so this is really great.

 
esieens

Joined: 2005-06-24
Posts: 65
Posted: Sat, 2007-11-10 09:06

Oups something got broken!

I posted a blog entry on Monday which included a Gallery2 picture. Everything worked fine until this morning. Somehow this am, the link is broken.

See :- http://www.walnut-grove.co.uk/blog/?p=31

Alos I just checked and the Image Gallery Chooser seems broken as well - not giving me a list of my albums.

However my gridblock is working fine!!!

Any idea what can be going wrong?

Thanks.

Addendum:- fyi - when i go to WPG2 -> WPG2 Validation Check: Valid -> View Page
I'me getting an error in the link being generated:- TMP_SESSION_ID_DI_NOISSES_PMT
Not sure if this is relevant. However I followd the FAQ regarding the permissions and cookies issues. Set the pacth to '/' and deleted my cookies on my PC. I do still have the same problem.

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Sat, 2007-11-10 17:05
esieens wrote:
I'me getting an error in the link being generated:- TMP_SESSION_ID_DI_NOISSES_PMT

That's not an error. It's what G2 does when it doesn't know how to sychronize cookies with the embedding platform.

Please see this link in the FAQ for syncronizing your cookies. It will fix the link, and will probably fix the overall problem.

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

 
esieens

Joined: 2005-06-24
Posts: 65
Posted: Sat, 2007-11-10 20:30

Thanks for that - unfortunately as per my previous post, I already had followed this FAQ.
Cookies Path is set to / in the General Settings.
I have also deleted my cache.

GridBlock is working but anything else is not.

You can check how it looks like on my main page:- www.walnut-grove.co.uk/blog

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Sat, 2007-11-10 20:49

Oh, yeah, sorry. I read it too quickly, seeing only the GALLERYSID part and not the part about you already following the FAQ...

That's really strange. Since your blog is at /blog/ and your gallery is at /gallery2/, setting it to / in the Gallery2 cookies section should work.

Another user reported the same problem here, but in the next post said that it started working correctly after some time. I'm thinking that maybe the template cache is storing the old links. Please try clearing it out by going to Gallery2 -> Site Admin -> Maintenance and clicking on "run now" next to "Delete template cache."

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

 
esieens

Joined: 2005-06-24
Posts: 65
Posted: Sun, 2007-11-11 07:17

Already tried it as well. No luck.

Is there anyway I could try to troubleshoot it by adding debug code? It is a behaviour that does not seem to affect the gridblock.

Many thanks for your help. Sorry to be a pain.

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Sun, 2007-11-11 11:52

Yes, please turn on debugging. Instructions here.

No pain. Just wish it were working...

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

 
esieens

Joined: 2005-06-24
Posts: 65
Posted: Sun, 2007-11-11 13:31

Turned buffered logging on.
I cannot see anything specific to WPG2 that could explain why I cannot view the picture.
It is still on if you want to have a look.

Also have a look at my main WPG2 page.

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Sun, 2007-11-11 18:15

I think something else has gone wrong. I'm seeing multiple errors on your blog page. Some look related to WPG2 not being active, but many others too. Are you working on it, or is there another problem?

It's also interesting that I'm seeing debug output on your gallery2 standalone page here, but not when it's embedded here.

Maybe Ozgreg has seen this before?

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

 
ozgreg
ozgreg's picture

Joined: 2003-10-18
Posts: 1378
Posted: Sun, 2007-11-11 22:35

Hmmm odd issue.. I can see a Gallery2 debug log in the WPG2 Output screen so WPG2 bridge between WP and G2 is working ok. It could be that you have php error reporting active, turn it off, I seen the output of php messages causing all sorts of weird behaviours before..

____________________________________
Wordpress / Gallery2 (WPG2) Plugin, , WPG2 Documentation, WPG2 Demo

 
esieens

Joined: 2005-06-24
Posts: 65
Posted: Mon, 2007-11-12 07:26

I turned off PHP reporting by setting error_reporting = 0 in my php.ini.
No difference unfortunately.

My blog is two years old so has been upgraded frpm 1.5 to 2.3 same for my gallery bu so far it has worked reliably.

The only error I could find related to WPG2 was in the gridblock on the block sidebar:-
Notice: Undefined variable: g2_isalbum in D:\xampp\htdocs\blog\wp-content\plugins\wpg2\wpg2embed.inc on line 1107

I have turned off the gallery debug so that it does not impact my users during the day but can turn it back on tonight.

Thanks

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Mon, 2007-11-12 12:41

Around line 1075 of wpg2embed.inc, try adding

$g2_isalbum = NULL;

so that it reads

			$ImageBlockData['divClass'] = $cssclass;
			$g2_isalbum = NULL;
			if ($size) {

Let's see if making sure that it's declared helps.

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

 
esieens

Joined: 2005-06-24
Posts: 65
Posted: Mon, 2007-11-12 21:11

Thanks - the error showing in the gridblock is gone!
Still no luck with the picture attached in my post or with the the Image Gallery Chooser.
I've left the debug on in case you want to have another look at it.
Thanks.

 
esieens

Joined: 2005-06-24
Posts: 65
Posted: Wed, 2007-11-14 06:55

I don't know why but it is working again now...
I have not touched/changed anything as I was not online yesterday.

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Wed, 2007-11-14 12:15

It's great that it's working. Maybe the errors were being cached.

Let us know if it stops working again.

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

 
esieens

Joined: 2005-06-24
Posts: 65
Posted: Wed, 2007-11-14 21:50

Will do.

Many thanks for your outstanding support.

 
esieens

Joined: 2005-06-24
Posts: 65
Posted: Sat, 2007-11-17 07:45

It got broken again... ;(

I guess this is to do with cookies and sessions.
Any idea?

Thanks.

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Sat, 2007-11-17 11:24

Since the blog sidebar image is working, but the wpg2 tag is not, and the embedded page is showing the Gallery2 sidebar, but not the meat of the Gallery2 page is not displaying, I'm wondering if there is a Gallery2 permissions issue? Since part of the connection between WP and G2 is working, we know that WPG2's paths are set correctly. Have you changed any of the default Gallery2 permissions? It looks like you have your main G2 installation password protected, so I'm wondering if that's the root cause.

I've forgotten, does everything work correctly if you're logged in as a WordPress admin?

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

 
esieens

Joined: 2005-06-24
Posts: 65
Posted: Sun, 2007-11-18 07:43

I have logged in as admin in WP - no difference.
I have the changed the code - as per details previously provided above - to login as the WP/WG2 admin (userID=1) ,it made no difference either.

To be honest I cannot remember how I set my gallery permissions. Done it two years ago so that you are asked to login automatically - no guest accounts.

Is there anything in particular you want me to check in the gallery admin page?

Thanks