coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 permissions => Topic started by: lupus2k5 on January 30, 2006, 03:46:42 AM

Title: Member Album Request
Post by: lupus2k5 on January 30, 2006, 03:46:42 AM
Here's a request.

After a member has registered, I want Coppermine to automatically create an album named their username. I don't mean a user gallery, I want an album, so it can be listed in the Ablums list.

Greatly appreciated to anyone who can help me with this. ;)
Title: Re: Member Album Request
Post by: Nibbler on January 30, 2006, 03:15:32 PM
Edit register.php, find


    $sql = "INSERT INTO {$CONFIG['TABLE_USERS']} ".
           "(user_regdate, user_active, user_actkey, user_name, user_password, user_email, user_profile1, user_profile2, user_profile3, user_profile4, user_profile5, user_profile6) ".
           "VALUES (NOW(), '$active', '$act_key', '" . addslashes($user_name) . "', '" . addslashes($encpassword) . "', '" . addslashes($email) . "', '$profile1', '$profile2', '$profile3', '$profile4', '$profile5', '$profile6')";
    if ($CONFIG['log_mode']) {
        log_write('New user "'.addslashes($user_name).'" created on '.date("F j, Y, g:i a"),CPG_ACCESS_LOG);
    }
    $result = cpg_db_query($sql)


after, add

cpg_db_query("INSERT INTO {$CONFIG['TABLE_ALBUMS']} (`title`) VALUES ('".addslashes($user_name)."')");
Title: Re: Member Album Request
Post by: lupus2k5 on January 31, 2006, 03:31:57 AM
Thank you!
Title: Re: Member Album Request
Post by: lupus2k5 on January 31, 2006, 03:41:17 AM
Okay, here's a harder one... :)
In upload.php, I'm hoping I can make it so that the only gallery they can upload to is the one that is their username. ;D

Thanks for the cooperation!
Title: Re: Member Album Request
Post by: Joachim Müller on January 31, 2006, 05:57:02 AM
What's the point of all this, why don't you use personal galleries, because what you're up to do is exactly what personal galleries are for? You can't limit upload permissions in public boards by user. What you're trying to accomplish currently isn't possible.
Title: Re: Member Album Request
Post by: lupus2k5 on February 04, 2006, 06:40:07 PM
This has nothing to do with public forums, and I am doing this because I am specific to this rather than using this "Personal Gallery" feature. If you'd prefer not to help me, I'll just have to do without it.
Title: Re: Member Album Request
Post by: Joachim Müller on February 05, 2006, 09:35:37 PM
not a matter of my personal preferences. I'm just giving advice, because that's what I thought you were looking for on this board. Like I said: coppermine is designed in a certain way, while you're trying to use it in another way. All I did was pointing out that there is a way to accomplish what you're trying to do with a slightly different setup.
There's no need to be rude.
Title: Re: Member Album Request
Post by: webfairy on February 18, 2006, 05:43:30 PM
Will this  work if you have attched coopermind to a phpbb board?  if yes please explain in detail.  ty


Quote from: Nibbler on January 30, 2006, 03:15:32 PM
Edit register.php, find


    $sql = "INSERT INTO {$CONFIG['TABLE_USERS']} ".
           "(user_regdate, user_active, user_actkey, user_name, user_password, user_email, user_profile1, user_profile2, user_profile3, user_profile4, user_profile5, user_profile6) ".
           "VALUES (NOW(), '$active', '$act_key', '" . addslashes($user_name) . "', '" . addslashes($encpassword) . "', '" . addslashes($email) . "', '$profile1', '$profile2', '$profile3', '$profile4', '$profile5', '$profile6')";
    if ($CONFIG['log_mode']) {
        log_write('New user "'.addslashes($user_name).'" created on '.date("F j, Y, g:i a"),CPG_ACCESS_LOG);
    }
    $result = cpg_db_query($sql)


after, add

cpg_db_query("INSERT INTO {$CONFIG['TABLE_ALBUMS']} (`title`) VALUES ('".addslashes($user_name)."')");
Title: Re: Member Album Request
Post by: Nibbler on February 18, 2006, 05:45:27 PM
No, it wont work with a bridge.
Title: Re: Member Album Request
Post by: webfairy on February 18, 2006, 08:50:56 PM
Thank you.  appreciate   ;D
Title: Re: Member Album Request
Post by: webfairy on February 18, 2006, 11:24:32 PM
Well exactly what is this Mod suspose to do?

I had a user register and log in and nothing happened.  even when they click the create album the suposidally action does not happen.

is not this suspose to automatacally make an album when they register?
Title: Re: Member Album Request
Post by: Nibbler on February 18, 2006, 11:29:08 PM
It does what the OP requested. Check you applied the mod correctly. If it still does not work post a link to your site, enable registrations and debug mode.
Title: Re: Member Album Request
Post by: webfairy on February 19, 2006, 02:37:47 PM
Ok,  How can I inow if I applyed the mod correctly if you won't tell  me exactly what to expect it to do.

From reading the original post they wanted an album in the users name to be automatacially created when the user resigestered...

This is where i inserted the new code.  After looking at it again and where you said to insert it I am not sure.
you say "after, add."  does this mean after the end of the top code or after a comma some where in the code?

                if ($CONFIG['enable_encrypted_passwords']) {
                        $encpassword = md5($password);
                } else {
                        $encpassword = $password;
                }

    $sql = "INSERT INTO {$CONFIG['TABLE_USERS']} ".
           "(user_regdate, user_active, user_actkey, user_name, user_password, user_email, user_profile1, user_profile2, user_profile3, user_profile4, user_profile5, user_profile6) ".
           "VALUES (NOW(), '$active', '$act_key', '" . addslashes($user_name) . "', '" . addslashes($encpassword) . "', '" . addslashes($email) . "', '$profile1', '$profile2', '$profile3', '$profile4', '$profile5', '$profile6')";
    if ($CONFIG['log_mode']) {
        log_write('New user "'.addslashes($user_name).'" created on '.date("F j, Y, g:i a"),CPG_ACCESS_LOG);
    }
    $result = cpg_db_query($sql);

[b]cpg_db_query("INSERT INTO {$CONFIG['TABLE_ALBUMS']} (`title`) VALUES ('".addslashes($user_name)."')");[/b]

    if ($CONFIG['reg_requires_valid_email']) {
        if (!$CONFIG['admin_activation']==1) { //user gets activation email
                                        $act_link = rtrim($CONFIG['site_url'], '/') . '/register.php?activate=' . $act_key;
                                        $template_vars = array(
                                                        '{SITE_NAME}' => $CONFIG['gallery_name'



Quote from: Nibbler on February 18, 2006, 11:29:08 PM
It does what the OP requested. Check you applied the mod correctly. If it still does not work post a link to your site, enable registrations and debug mode.
Title: Re: Member Album Request
Post by: webfairy on February 19, 2006, 03:01:38 PM
Here is link to site:

http://www.waterfowlmeetingplace.com/ourgallery/index.php

the register is on and the debug is on. for users
Title: Re: Member Album Request
Post by: Nibbler on February 19, 2006, 03:10:30 PM
Judging by the debug output, you have not implemented this mod atall. Verify that you have actually editted and uploaded the file.
Title: Re: Member Album Request
Post by: webfairy on February 19, 2006, 03:41:06 PM
Nibbler  could you please tell me how to do this.  I opened the register.php file and inserted the code. 

what do I have to do.

Also did I put th e code in the right place?

Title: Re: Member Album Request
Post by: AWJunkies on February 21, 2006, 04:41:28 AM
[ b ] cpg_db_query("INSERT INTO {$CONFIG['TABLE_ALBUMS']} (`title`) VALUES ('".addslashes($user_name)."')");[ /b ]

it should be

cpg_db_query("INSERT INTO {$CONFIG['TABLE_ALBUMS']} (`title`) VALUES ('".addslashes($user_name)."')");

You have [ b ] and [ /b ] in there for some reason. This can work with bridge if you change your forum register and add this code only if databases are on same database system if not just grab the coppermine database info real quick and walla. I have it working with a bridge and a network (meaning not only a bridge but multiple sites 22 to be exact). I like this mod because everyone asks how to make an album or how to upload or what is going on. It just makes it easier for the users to just click upload and be able to upload right away. Then when they start to figure more things out they will see they can add more albums.

Please don't ask me how to make it work for a bridge!

Thanks Nibbler as always.
Title: Re: Member Album Request
Post by: webfairy on February 21, 2006, 01:43:44 PM
AW, thanks.. but I have a couple of questions...

I do not see any change in the two you did below.  am I blind or what?  :)

I also need to know EXACCTLY where to put this. 

log_write('New user "'.addslashes($user_name).'" created on '.date("F j, Y, g:i a"),CPG_ACCESS_LOG);
    }
    $result = cpg_db_query($sql);

Do i put it exactly after the ($sql) and before the ;?    if so that leaves two ;'s at the end.  is that an and sign? 

AW, is the mod for a bridge so difficult?  I have both my forum and album on the same host. So I think i can use the same data base for the album.  I have not even tryed to bridge this yet...  If i can't get a couple of simple mods to work I am not ready to try bridging. LOL

Please post the mod you did for "databases are on same database system" just in case.   but you can put this on the back burner and do it in your spare time or when you get a block on another mod and just need to look at something else.  :)


Quote from: AWJunkies on February 21, 2006, 04:41:28 AM
cpg_db_query("INSERT INTO {$CONFIG['TABLE_ALBUMS']} (`title`) VALUES ('".addslashes($user_name)."')");

it should be

cpg_db_query("INSERT INTO {$CONFIG['TABLE_ALBUMS']} (`title`) VALUES ('".addslashes($user_name)."')");

You have and in there for some reason. This can work with bridge if you change your forum register and add this code only if databases are on same database system if not just grab the coppermine database info real quick and walla. I have it working with a bridge and a network (meaning not only a bridge but multiple sites 22 to be exact). I like this mod because everyone asks how to make an album or how to upload or what is going on. It just makes it easier for the users to just click upload and be able to upload right away. Then when they start to figure more things out they will see they can add more albums.

Please don't ask me how to make it work for a bridge!

Thanks Nibbler as always.
Title: Re: Member Album Request
Post by: Nibbler on February 21, 2006, 01:50:56 PM
I've adjusted AWJunkies's post so that the bbcode is visible.

Quote from: webfairy on February 21, 2006, 01:43:44 PM
I also need to know EXACCTLY where to put this. 

log_write('New user "'.addslashes($user_name).'" created on '.date("F j, Y, g:i a"),CPG_ACCESS_LOG);
    }
    $result = cpg_db_query($sql);

You don't put it anywhere, leave it exactly where it is and add the new line of code after it.
Title: Re: Member Album Request
Post by: webfairy on February 21, 2006, 02:24:16 PM
Thanks.  I was just confused by the after , add
and that little , in there.  sorry. 

Thanks again for the great mod.


Quote from: Nibbler on February 21, 2006, 01:50:56 PM
I've adjusted AWJunkies's post so that the bbcode is visible.

You don't put it anywhere, leave it exactly where it is and add the new line of code after it.
Title: Re: Member Album Request
Post by: AWJunkies on February 21, 2006, 10:10:05 PM
Thanks nibbler i was doing it real fast and totaly forgot that it would bold it and not show him what I ment. Thanks for the edit.
Title: Re: Member Album Request
Post by: nickfzx on March 09, 2007, 08:02:04 PM
As GauGau rightly said earlier in the thread personal galleries are the way to go.

so with that in mind I have worked out how to create personal galleries at registration when bridged with punbb  (but could easily be adapted to work with other BBs)

add this code underneath the "Add new user" section in punbb's register.php file:

// mod: create new gallery for user
$category_id = ($new_uid+10000);

    $db->query('INSERT INTO copper_albums (title, uploads, category) VALUES(
        \''.$username.'`s gallery\',
        \'YES\',
        \''.$category_id.'\'
    )');


Now my coppermine database prefix is "copper_" so you will have to change this to whatever yours is.  Also my coppermine tables are in the same DB as my PunBB tables so that is a requirement here too.

it seems to work perfectly for me although I have not vigorously tested it.  If anyone can spot any mistakes in it please let me know.