forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: jasonfrance on August 19, 2006, 06:18:59 pm

Title: Automatically Create Album When User Registers
Post by: jasonfrance 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
Title: Re: Automatically Create Album When User Registers
Post by: eruss on August 19, 2006, 07:14:53 pm
Use forum search:

http://forum.coppermine-gallery.net/index.php?topic=27149.0
Title: Re: Automatically Create Album When User Registers
Post by: jasonfrance 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?
Title: Re: Automatically Create Album When User Registers
Post by: Nibbler 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)");
Title: Re: Automatically Create Album When User Registers
Post by: jasonfrance on August 19, 2006, 09:58:00 pm
Sweet.  Thank you for quick reply.  Works beautifully
Title: Re: Automatically Create Album When User Registers
Post by: dedj 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
Title: Re: Automatically Create Album When User Registers
Post by: Nibbler on September 06, 2006, 11:12:13 pm
You can't use this with a bridge since the users don't register through Coppermine.
Title: Re: Automatically Create Album When User Registers
Post by: dedj 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?
Title: Re: Automatically Create Album When User Registers
Post by: Nibbler on September 06, 2006, 11:48:06 pm
You can't use this with a bridge since the users don't register through Coppermine.
Title: Re: Automatically Create Album When User Registers
Post by: dedj 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?

Title: Re: Automatically Create Album When User Registers
Post by: Nibbler on September 06, 2006, 11:52:50 pm
If you know what you are doing then yes, otherwise no.
Title: Re: Automatically Create Album When User Registers
Post by: dedj on September 06, 2006, 11:58:51 pm
ok if it worke i say it!

I make now first an backup ;)
Title: Re: Automatically Create Album When User Registers
Post by: Joachim Müller on September 07, 2006, 01:58:41 am
Locking.