forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: ninoo on January 08, 2012, 10:33:49 am

Title: Hack for coppermine albums to automatically fill in personal gallery for new reg
Post by: ninoo on January 08, 2012, 10:33:49 am
Hello everyone
sorry for my bad English, but I need your big help.
1.5 I installed coppermine on my site but I would change it so it automatically when a user registers you create a personal gallery with three personal albums Type A, B, C. I know that coppermine does not allow this, but I think we can make anda small hack to automatically create them.
Thanks for your help
greetings from italy
Title: Re: Hack for coppermine albums to automatically fill in personal gallery for new reg
Post by: Αndré on January 10, 2012, 04:31:20 pm
Open register.php, find
Code: [Select]
    // Create a personal album if corresponding option is enabled
    if ($CONFIG['personal_album_on_registration'] == 1) {

        $catid = mysql_insert_id() + FIRST_USER_CAT;
        cpg_db_query("INSERT INTO {$CONFIG['TABLE_ALBUMS']} (`title`, `category`) VALUES ('$user_name', $catid)");
    }
and replace with something like
Code: [Select]
    // Create a personal album if corresponding option is enabled
    if ($CONFIG['personal_album_on_registration'] == 1) {

        $catid = mysql_insert_id() + FIRST_USER_CAT;
        cpg_db_query("INSERT INTO {$CONFIG['TABLE_ALBUMS']} (`title`, `category`) VALUES ('Type A', $catid)");
        cpg_db_query("INSERT INTO {$CONFIG['TABLE_ALBUMS']} (`title`, `category`) VALUES ('Type B', $catid)");
        cpg_db_query("INSERT INTO {$CONFIG['TABLE_ALBUMS']} (`title`, `category`) VALUES ('Type C', $catid)");
    }

Don't forget to enable the option "Create user album in personal gallery on registration" in the config.

Additionally, you want to apply the same mod to usermgr.php.
Title: Re: Hack for coppermine albums to automatically fill in personal gallery for new reg
Post by: ninoo on January 11, 2012, 08:07:13 pm
Thanks you are great, but I can not enable the "Create user albums in personal gallery on registration" 'cause I use a bridge that disables this option.
Do you have any idea to solve the problem?

thanks
Title: Re: Hack for coppermine albums to automatically fill in personal gallery for new reg
Post by: Αndré on January 12, 2012, 08:23:29 am
If your gallery is bridged the registration process is completely handled by your board application. Coppermine doesn't know when a new user is registered, so you'll have to modify your board application to create the albums in the Coppermine database. I cannot help you any further with that issue, as I don't know your board application (whichever you use).
Title: Re: Hack for coppermine albums to automatically fill in personal gallery for new reg
Post by: ninoo on January 12, 2012, 01:28:17 pm
I use as a bridge "purple_cpg_bridge - A plugin to form a bridge between e107 and Coppermine" (http://www.purplescroll.com)
Use e107 and coppermine with purple_cpg_bridge.  :-\

I see the solution to this problem very difficult if not impossible for me  :'(
thanks for all the information I gave  ;) :)
Title: Re: Hack for coppermine albums to automatically fill in personal gallery for new reg
Post by: ninoo on January 26, 2012, 02:30:44 pm
very well. OK it works! :)

I added making modifying Αndré works with the bridge.

The solution 'lies in the very simple to manage groups directly from the bridge and also reads automatically the changes to the management of albums.

Here is the result www.smallbigmedia.net (http://www.smallbigmedia.net) or www.smallbigmedia.com (http://www.smallbigmedia.com)

Thanks to all, especially Αndré.
Title: Re: Hack for coppermine albums to automatically fill in personal gallery for new reg
Post by: Αndré on January 26, 2012, 03:09:09 pm
Resolve your threads
If you have found an answer to your question, resolve your thread. Don't just post "I have found the answer", but tell others what you actually did to solve your issues. Posting a link to the page where you found the answer might help. Describing what you did might help as well. Finally, you can tag your answer as "solved" by clicking on the "Topic Solved" button on the bar at the left hand side at the bottom of your thread.

Please post the code changes and mark your thread as solved. Thanks.
Title: Re: Hack for coppermine albums to automatically fill in personal gallery for new reg
Post by: ninoo on January 29, 2012, 12:14:48 am
OK
in practice:

1) Activate the tunnel with the bridge and configure it all.
2) Turn off the bridge
3) Edit the register.php as explained by Αndré
4) Activate the bridge

The system is not 'scientific but it works very well:)

Hello
Title: Re: Hack for coppermine albums to automatically fill in personal gallery for new reg
Post by: ninoo on January 30, 2012, 12:07:05 pm
The problem that this technique works only if you walk into the gallery as a group administrator, but not as a user group. How can 'do? I can not give permission to all administrators and make them. I need to find a solution to this problem
Title: Re: Hack for coppermine albums to automatically fill in personal gallery for new reg
Post by: Αndré on February 01, 2012, 10:53:21 am
Sorry, but I neither comprehend your tutorial nor what it has to do with "group administrator" or "user group". I thought you need to
automatically when a user registers you create a personal gallery with three personal albums Type A, B, C.
?
Title: Re: Re: Hack for coppermine albums to automatically fill in personal gallery for new reg
Post by: B3000 on November 29, 2012, 02:10:08 pm

Additionally, you want to apply the same mod to usermgr.php.

I´ve made the same thing that it now creates a couple of albums automatically with registration.

However, as a regular user I can´t see these and can not modify them. I only can see albums that I - as a regular user - have created by myself.
When I am logged in as a different user I can see these automatically created albums from other users but not mine.

Refering to the quote above: I did not know how to apply the same mod to usermgr.php - but I don´t think this is the solution. Am I wrong?
Title: Re: Hack for coppermine albums to automatically fill in personal gallery for new reg
Post by: Αndré on November 29, 2012, 02:40:22 pm
Try
Code: [Select]
    // Create a personal album if corresponding option is enabled
    if ($CONFIG['personal_album_on_registration'] == 1) {
        $user_id = mysql_insert_id();
        $catid = $user_id + FIRST_USER_CAT;
        cpg_db_query("INSERT INTO {$CONFIG['TABLE_ALBUMS']} (`title`, `category`, `owner`) VALUES ('Type A', $catid, $user_id)");
        cpg_db_query("INSERT INTO {$CONFIG['TABLE_ALBUMS']} (`title`, `category`, `owner`) VALUES ('Type B', $catid, $user_id)");
        cpg_db_query("INSERT INTO {$CONFIG['TABLE_ALBUMS']} (`title`, `category`, `owner`) VALUES ('Type C', $catid, $user_id)");
    }
Title: Re: Re: Hack for coppermine albums to automatically fill in personal gallery for new reg
Post by: Αndré on November 29, 2012, 02:49:51 pm
I did not know how to apply the same mod to usermgr.php - but I don´t think this is the solution.

You just need to apply the mod to that file if you create users manually (= if they don't register themselves). The mod looks very similar, just search for $CONFIG['personal_album_on_registration'].
Title: Re: Hack for coppermine albums to automatically fill in personal gallery for new reg
Post by: B3000 on November 29, 2012, 03:44:51 pm
Oh yeah, this helped for  new registrations.

But: I have encountered a different problem now. The captcha did not show up on the registration page - so I had do disable this option in the settings to be able to create a new account - to see if the new code works for new users.
Title: Re: Hack for coppermine albums to automatically fill in personal gallery for new reg
Post by: Αndré on November 29, 2012, 03:50:54 pm
10. One question per thread
We have a strict "One question/issue per thread rule", which helps both supporters/moderators to keep track of open/closed issues as well as users who search the board or browse it, looking for answers to their question. Don't try to "hijack" other's threads by posting unrelated questions to an existing thread.