Advanced search  

News:

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

Pages: [1]   Go Down

Author Topic: Automatically Create Album When User Registers  (Read 10305 times)

0 Members and 1 Guest are viewing this topic.

jasonfrance

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Automatically Create Album When User Registers
« on: August 19, 2006, 06:18:59 pm »

Morning,

I was wondering if there was a why to automatically create an album (based on the username) when a user registers?

I've searched the forum/google and wasn't able to find much...

Jason
« Last Edit: August 19, 2006, 10:16:23 pm by Nibbler »
Logged

eruss

  • Supporter
  • Coppermine frequent poster
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 105
Logged

jasonfrance

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Automatically Create Album When User Registers
« Reply #2 on: August 19, 2006, 08:55:38 pm »

Hmmm...  I search for "auto create" and "create album" and didn't find anything.  Thanks!

So I implemented the code line into the register.php file, and it is automatically making an album.  But it isn't accessible for the newly registered user.  Only the admin can access the new album (which was made with the user's name).  It looks like (in phpMyAdmin) the category for the album is not being set to the user_id of the user.  So the album doesn't show up under the user's login (just the admin's).

I'm not sure how I can get the user_id and insert it during the register process.  It looks like the user_id is autogenerated number.  And it looks like the category prepends a 1000 to the number.  So the user_id might be 6 and the category in the album table would be 10006.

Any thoughts on how to insert the correct user_id as category in the album table so the album shows up for the user?
Logged

Nibbler

  • Guest
Re: Automatically Create Album When User Registers
« Reply #3 on: August 19, 2006, 09:04:43 pm »

Try this code instead. What you are asking is slightly different to the user in that thread.

Code: [Select]
$catid = mysql_insert_id() + FIRST_USER_CAT;
cpg_db_query("INSERT INTO {$CONFIG['TABLE_ALBUMS']} (`title`, `category`) VALUES ('".addslashes($user_name)."', $catid)");
Logged

jasonfrance

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Automatically Create Album When User Registers
« Reply #4 on: August 19, 2006, 09:58:00 pm »

Sweet.  Thank you for quick reply.  Works beautifully
Logged

dedj

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 7
Re: Automatically Create Album When User Registers
« Reply #5 on: September 06, 2006, 11:11:11 pm »

did this mod work with bridge?

i use smf
Or is my code bad?

Code: [Select]
  }
    $result = cpg_db_query($sql);
    $catid = mysql_insert_id() + FIRST_USER_CAT;
cpg_db_query("INSERT INTO {$CONFIG['TABLE_ALBUMS']} (`title`, `category`) VALUES ('".addslashes($user_name)."', $catid)");
    if ($CONFIG['reg_requires_valid_email']) {
        if (!$CONFIG['admin_activation']==1) { //user gets activation email
                                        $act_link = rtrim($CONFIG['site_url'], '/

dj
Logged

Nibbler

  • Guest
Re: Automatically Create Album When User Registers
« Reply #6 on: September 06, 2006, 11:12:13 pm »

You can't use this with a bridge since the users don't register through Coppermine.
Logged

dedj

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 7
Re: Automatically Create Album When User Registers
« Reply #7 on: September 06, 2006, 11:18:18 pm »

ok i make a test and make a new user but i find now album!
is the mistake that i dont make an database update?
Logged

Nibbler

  • Guest
Re: Automatically Create Album When User Registers
« Reply #8 on: September 06, 2006, 11:48:06 pm »

You can't use this with a bridge since the users don't register through Coppermine.
Logged

dedj

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 7
Re: Automatically Create Album When User Registers
« Reply #9 on: September 06, 2006, 11:51:32 pm »

i know smf is don't supported but can i use the code in the smf register?

Logged

Nibbler

  • Guest
Re: Automatically Create Album When User Registers
« Reply #10 on: September 06, 2006, 11:52:50 pm »

If you know what you are doing then yes, otherwise no.
Logged

dedj

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 7
Re: Automatically Create Album When User Registers
« Reply #11 on: September 06, 2006, 11:58:51 pm »

ok if it worke i say it!

I make now first an backup ;)
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: Automatically Create Album When User Registers
« Reply #12 on: September 07, 2006, 01:58:41 am »

Locking.
Logged
Pages: [1]   Go Up
 

Page created in 0.031 seconds with 20 queries.