This is driving me INSANE!

elizaleahy

Joined: 2005-10-23
Posts: 40
Posted: Wed, 2005-10-26 06:04

PHP (more info) 4.4.0 -
PERL (more info) 5.6.1
Ruby 1.8.1
Python 2.3.3
MySQL 4.0.26 -

Gallery 2.0.1

I installed gallery 2.0.1

I moved all the albums from version 1.* over. 304 albums, I don't know how many pictures. A lot.

Now, I want people to be able to access their albums. So I install the modual "User Albums"

What happens now is that the little "your album" button appears next to the "login" button.

That's great, but when they login their album shows as empty. If they click to add a photo it creates a NEW album, instead of putting it in their old album. Any idea why this is so?

Next - I remove the "User Albums". That gets rid of that problem. Now they have to search for the album to add to it. I can live with that.

Except that now I don't seem to have a way for new people to create albums. I can add new users, but they can't DO anything? How can I fix that?

I seem to be going around in circles!

Any help would be MUCH appreciated!

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2005-10-26 11:38

g1 user albums (if that exists in g1) are not migrated to g2 user albums.

if you had a lot of albums in g1 that were owned by other users, that should be migrated fine.
the migration first imports the g1 users to g2. then it imports all g1 albums and items to g2 and preserves the ownership.
no need to enable g2 user albums.

 
elizaleahy

Joined: 2005-10-23
Posts: 40
Posted: Wed, 2005-10-26 11:49

So what do I do to solve the problem I have now?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2005-10-26 11:58

what you need is to link your existing user albums to g2 type user albums.
we had a similar issue a few days ago in the forums. the user solved it i guess with a few manual sql queries.

 
elizaleahy

Joined: 2005-10-23
Posts: 40
Posted: Wed, 2005-10-26 11:59

I'm sorry, I don't understand :(

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2005-10-26 12:03

could you tell me why we're having the same discussion in two topics??

http://gallery.menalto.com/node/39039

can i lock the other discussion? this is silly and wasts my time.

@your problem:
please try your luck with the forum search funciton. the same issue was kinda solved for another user less than 7-14 days ago.

 
joe7rocks
joe7rocks's picture

Joined: 2004-10-07
Posts: 560
Posted: Wed, 2005-10-26 16:15

Dear elizaleahy,
Let me describe some things about this problem.

First of all, imagine what if a user had 3albums in your old g1 root album.
That would mean you imported 3albums for 1user into g2. How should the useralbums module know which 1 to link to?
What useralbums module does is:
-automatically creats a new album for new users at registration time OR at the first login of the user
-puts a link to the root album of the user, which is always at http://www.yourgallerydomain.com/username/ when it's created. (it means if the user has his/her album at any other place than http://www.yourgallerydomain.com/username/, then that will be "ignored" and the useralbums module creates a new album for the user at .../username/)

What you need to do/what you can do is the following:
Version1:
modify the migration module to import all albums of a user(if that had more than 1 in g1 root) into www.yourgallery2.com/username/ (so the old albums could be accessible at www.yourgallery2.com/v/username/oldalbumname1 www.yourgallery2.com/v/username/oldalbumname2 etc).. or pending that all of you users had only 1 album in g1, then you can migrate that simly into www.yourgallery2.com/username/

For these you have to modify the phpcode (be sure to read "note2" if all your users had only 1 rootalbum in g1):
(at about line 393)

-MAKE a backup copy of your g2installdir/modules/migrate/ConfirmImport.inc
(no support if you didn't do it!;)

-search for the following code in your ConfirmImport.inc
/*
* if the album's parent is not in the list of sourcealbums,
* load it into the targeted G2 top album as set in $destinationAlbumID
*/
$targetAlbumID = $newAlbumInstanceId = $isHiddenAlbum = false;
if (!in_array($album['parentAlbumName'], array_keys($form['sourceAlbums']))) {
$targetAlbumID = $destinationAlbumID;

-comment out the last line (add "//" before that), so to look like this:
//$targetAlbumID = $destinationAlbumID;

-insert this right after that line:
list ($ret, $albumIds) = $gallery->search('select [GalleryChildEntity::id] from [GalleryChildEntity], [GalleryFileSystemEntity] where [GalleryChildEntity::parentId] = 7 and [GalleryFileSystemEntity::id]=[GalleryChildEntity::id] and [GalleryFileSystemEntity::pathComponent] = ?', array($userName));

if ($ret->isError()) {
return array($ret->wrap(__FILE__, __LINE__), null);
}

//i just see it atm being a piece of shit:) code should be polished up :>
while ($result = $albumIds->nextResult()) {
$userAlbumanakIdje = $result[0];
}

$targetAlbumID = $userAlbumanakIdje;

-if You did it right, your next line in the code should be:
if ($album['parentAlbumName'] != '.root') {
do not modify it! :)

OK. that's all.
It should do the following _when migrating_:
If a user had albums in g1 at www.yourg1.com/example1/ and www.yourg1.com/example7/ ..then it should import those as www.yourg2.com/v/username/example1/ and www.yourg1.com/example7/ . So when you turn on useralbums module, then it points to the root of all albums of that user (www.yourg2.com/v/username/).

note2: if all your users had only 1(root) album in g1..and you want to import those as www.yourg2.com/username ..then you have to completely different thing..
in this it might be better to modify the useralbums module (see "Version2")..or you could change the target directory name of the albums..(to be username)
i did NOT tested this code, im even NOT sure if it works right..i just looked up the code for you.
It has to be done in ConfirmImport.inc also:

-backupcopy

-Search for this:
$desiredname = $platform->legalizePathComponent($album['name']);

-comment that
//$desiredname = $platform->legalizePathComponent($album['name']);

-add this right after:
$desiredname = $platform->legalizePathComponent($album['owner']);

-save, exit

I'm pretty sure this will *not* work for albums _inside_ the root useralbums.
So! Please import first the rootalbums in g1, then remove this last 1 line modification, and import all the subalbums after this.

Or if you would prefer this in 1 step..then add some more line to our modification above(i did not test this either):

-backupcopy of ConfirmImport.inc

-search our brand new:
$desiredname = $platform->legalizePathComponent($album['owner']);

-put this line _before_ that:
if ($album['parentAlbumName'] ! '.root') {

-put this _after_ that:
}
else {
$desiredname = $platform->legalizePathComponent($album['name']);
}

-save exit

note++:i did not nested if mapped g1->g2 redirections worked after these

Version2:
*somehow* modify the useralbums module, so if a user already has an album at www.gallery2root.com/somethingelsethanusername/ then do not create a new album /username/ instead show the link to the existing gallery.
(it could be some kind of gallery->search with the userid, the albums, and the paths..)

:)

 
elizaleahy

Joined: 2005-10-23
Posts: 40
Posted: Wed, 2005-10-26 21:57

Thanks for all your help.