Pages (3): 1 2 3   
Member
Member
gwmbox   17-12-2010, 15:01
#1

OK, who stole the 'how to use a login for private albums' how to manual?

Let me describe what I am 'trying' to do.

I have an album, lets call it Private Album.

In Private Album I have 10 or more Sub Albums.

Each Sub Album is password protected individually for ten different users.

When on the front end the user selects the Private Albums folder, currently they see the ten albums all with the lock in the middle, BUT, What I want it to do is show a login form (if not already logged in) and NOT show any of the albums at all, i.e.show nothing unless they are logged in (expect for the login form of course).

Once they have logged in correctly they will then be able to see their album, and only their album, the other nine remain hidden.

Now I thought this was an easy thing to do, maybe I am just tired, but I am going around in circles trying to work it out.

I found the login_out plugin and that is activated, I have included the login_out part on the theme page to display it, and that works, but all the albums still exist and are showing and not being hidden.

What else do I need to do or what else have I forgotten to do?

version 1.3.1.2 [6342]

Cheers

GW

Administrator
Administrator
acrylian   17-12-2010, 15:05
#2

Actually you have to protect the "private album" as well to see a login form instead of showing the subalbums.

Or you modify your theme to use if(isMyAlbum()) { .... } else { .... }

Note: 1.3.2 will have some changes to the object model there isMyAlbum will be replaced with a album class method isMyItem()(actually all protectable items have this then). You can preview that on the nightly of course.

Member
Member
gwmbox   17-12-2010, 15:36
#3

OK, So I am using the nightly builds [6342] so isMyItem I assume is what is need to use...

Is that the same params as the isMyAlbum?

So having that in place will then enable me to hide all albums in the 'Private Album' unless it is theirs correct? That will also not require me to protect the 'Private Album' either, as I want that shown with the login form only.

Cheers

GW

Member
Member
gwmbox   17-12-2010, 16:17
#4

Can I also ask what or how do you use the action? Do you have an example and/or example code I can view to see how it works?

Cheers

GW

Administrator
Administrator
acrylian   17-12-2010, 18:20
#5

It is a class method so you use it with a album object (you should know this by now..;-)) so use it within the next_album loop with if($_zp_current_album->isMyItem()) { ... }

It has only one parameter for the rights (you can alway look at the file for the documentation comment, our doc is generated from these).

Member
Member
gwmbox   18-12-2010, 03:02
#6

You are right, I do, it was just a late night and I should have gone to bed and looked at it with fresh eyes

Thanks anyway

Cheers

GW

Member
Member
gwmbox   19-12-2010, 05:33
#7

OK, I thought I had it but I am not getting the right result.

Using your example above and adding that after the while next loop provided me with the non showing of the albums which works, but it applies this to all albums not just the protected ones.

Then when I use the login form it is applying that login to the 'Private Album' rather than doing a global type login to then be able to show the sub album(s) for that user. The idea is that the login is applied and they are still viewing the 'Private Album' but now they can see any sub album(s) that belong to them... I hope that makes sense.

I am still going through the documents and trying to figure this out but I must be missing something or just overlooking it... though if you have a quick answer please let me know.

I think this would make a great FAQ once sorted out too.

I tried to do this via user accounts but it would seem that you cannot segment accounts to specific albums.

Additionally for printAlbumMenuList() how do I set it to not show the list of sub-albums for that private album but continue to show sub albums of the other albums in the menu.

Thanks

GW

Administrator
Administrator
acrylian   19-12-2010, 11:07
#8

Well, my above example will not display all albums in that loop that the current visitor has not the right to see. I should probably have mentioned that this is meant for users with albums assigned to manage.

Please take the time and look at the album class, there are further methods for checks like checkAccess() or even bettercheckForGuest that might be better suited.

Quote: tried to do this via user accounts but it would seem that you cannot segment accounts to specific albums.
This should be possible with user groups.

The album menu does not hide protected albums as this is not how Zenphoto is actually setup. Normally we should the form once you click on it. You would have to make your own custom version.

Member
Member
gwmbox   19-12-2010, 14:52
#9

Thanks for that, it has given me an idea which I will try and see how it works and I will return back with hopefully the solution to my request so others can hopefully find useful :0

Cheers

GW

Member
Member
gwmbox   20-12-2010, 05:00
#10

I am still playing with this and trying to get it to work the way I want... I am sure I will figure it out soon.

Question however... if I am just using the album password protect in place of the user accounts and then have a login form on the 'private album' page, how do I get it to accept the login on that page and not show an error when they login on that page.

I realise the error is caused by the fact they are trying to login to the 'private album' which has no password security attached to it so it says sorry error no login, but I want to have it enable the user to login on that page and for the login to work on that page without the error. The security for albums are the sub albums of the 'private album'.

Can you explain how I can do that please.

Cheers

GW

Member
Member
sbillard   20-12-2010, 05:39
#11

Not going to work. You can't log into an album that is not password protected, there is nothing to log into.

You could make these users full Zenphoto users, though. Then they would be logging into the gallery as a whole, not the album. Of course you would need to enable the user field on the login form.

Member
Member
gwmbox   20-12-2010, 05:54
#12

OK, thanks I will try setting up the user accounts. Is it then the same or a different login form?

For the checkaccess function, is that just a return of true or false, just not in the documentation as far as I can see, basically I have;

in albums.php

`

the sub album content

the sub album content

`
Can you see what I have done wrong (if anything)?

Thanks

GW

Member
Member
gwmbox   20-12-2010, 08:58
#13

Also how does the 'user account' actually work? I do not want them to manage any albums, just limited to protected albums they are allowed to see?

Having two user/password systems I think is what causes the issues that exist (well at least for us) in that neither function of the protection or user system quite do what you (we) would expect them to do.

The album protection provides access to the album via a password but it does not hide the albums existence to others unless you keep it unpublished. But then the user that should have access to it cannot login via a form on the system to then go to it. Instead they must know the url and type it in or use another form of communication such as email to get the link. Then once they know it they can visit it and then login. Surely it would be better (imho) if there was a simple login function on the site, they login and browse the site, any albums that are protected but they have access to are displayed as usual. Those albums they do not have access to remain hidden as if they do not exist.

A solution could simply be that any album that is to be restricted is tagged as such. Then user (or group) access is provided to the album from the user access system. Or from the users account they have albums assigned to them, or with groups the groups have albums assigned to them. This of course is only for those protected albums not for unprotected.

I am not sure what all the above would take and/or if others agree with me, but it is just some feedback on how I see the current protected album and user access system.

In the meantime is there a way to add to the user access a View album instead of Manage album and then select those albums... oh hang on that is what I asked for above

Also why does manage album only show the top albums?

Thanks

Greg

Administrator
Administrator
acrylian   20-12-2010, 11:30
#14

Quote:Also why does manage album only show the top albums?
Besides other reasons for performance reasons because Zenphoto is filesystem based.

If you want to hide protected albums totally I did give some ideas above, I think.

I will leave the general answers to sbillard though.

Member
Member
gwmbox   20-12-2010, 14:57
#15

Yes thanks you did give me an idea which is why I ended up with

`

the sub album content

the sub album content

`
Is there a way I can check for current logged in user, as in their username and then I can use a check to see if the username = that of the protected album using customer data.

That is the only way I can think of to get it to work... as I said I am learning php but my knowledge cannot figure out any other way (yet)

My comments above about the user system are just feedback from a users point of view, please do not take them as a negative view.

Cheers

GW

Member
Member
gwmbox   20-12-2010, 16:17
#16

Is there a way to when on an album page, to check the sub-album custom-data field or codeblock for 'each' sub-album?

If this can be done I can then assign a user to the protected albums custom data or codeblock for that users name and if it is then the sub-album can be shown, if not the the sub-album is not shown? I am sure this could be built into the while loop....

Hoping there is, if so please help me.

Cheers

GW

Administrator
Administrator
acrylian   20-12-2010, 16:23
#17

You can check if the current user/visitor is loggedin by using if(zp_loggedin()) { }.

Of course you can check each field, using the object model stuff. But since anyone would be able to view that album via a direct link anway.. Also sublevel items always inherit the protection.

Member
Member
gwmbox   20-12-2010, 16:53
#18

Yes yes I know that and how to check if logged in, I am trying to verify who is logged in against the sub-album, and I know about sub-albums inheriting the parent album, BUT the parent album is NOT protected for a reason.

So back to my question.... Is there a way to when on an album page, to check the '[b]sub-albums[/b]' custom-data field or codeblock for 'each' sub-album?

Thanks

GW

Administrator
Administrator
acrylian   20-12-2010, 16:59
#19

Yes, use the object model to get the subalbum objects and check the fields.

Member
Member
gwmbox   20-12-2010, 17:03
#20

OK, now I know it 'can' be done... I will have a play and see what I come up with and get back to everyone if it works... fingers crossed

I have it checking if logged in, I have it identifying who is logged in, now I just need to work out the way to check that against the sub-albums custom data or codeblock information

GW

Pages (3): 1 2 3   
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.