Advanced search  

News:

cpg1.5.44 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter recently discovered vulnerabilities. It is important that all users who run version cpg1.5.42 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Hack for coppermine albums to automatically fill in personal gallery for new reg  (Read 12738 times)

0 Members and 1 Guest are viewing this topic.

ninoo

  • Coppermine newbie
  • Offline Offline
  • Posts: 9

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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15244

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.
Logged

ninoo

  • Coppermine newbie
  • Offline Offline
  • Posts: 9

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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15244

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).
Logged

ninoo

  • Coppermine newbie
  • Offline Offline
  • Posts: 9

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  ;) :)
Logged

ninoo

  • Coppermine newbie
  • Offline Offline
  • Posts: 9

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 or www.smallbigmedia.com

Thanks to all, especially Αndré.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15244

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.
Logged

ninoo

  • Coppermine newbie
  • Offline Offline
  • Posts: 9

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
Logged

ninoo

  • Coppermine newbie
  • Offline Offline
  • Posts: 9

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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15244

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.
?
Logged

B3000

  • Coppermine newbie
  • Offline Offline
  • Posts: 6


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?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15244

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)");
    }
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15244

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'].
Logged

B3000

  • Coppermine newbie
  • Offline Offline
  • Posts: 6

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.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15244

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.
Logged
Pages: [1]   Go Up
 

Page created in 0.073 seconds with 20 queries.