Automatically Create Album When User Registers Automatically Create Album When User Registers
 

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]

Main Menu

Automatically Create Album When User Registers

Started by jasonfrance, August 19, 2006, 06:18:59 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jasonfrance

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


jasonfrance

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?

Nibbler

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


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

jasonfrance

Sweet.  Thank you for quick reply.  Works beautifully

dedj

did this mod work with bridge?

i use smf
Or is my code bad?

  }
    $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

Nibbler

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

dedj

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?

Nibbler

Quote from: 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.

dedj

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


Nibbler

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

dedj

ok if it worke i say it!

I make now first an backup ;)

Joachim Müller