coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 ecards & email => Topic started by: Informator on February 18, 2006, 12:03:25 AM

Title: Display user email address in activation request?
Post by: Informator on February 18, 2006, 12:03:25 AM
Hi,

I run a gallery for a student society, whereby I only want to grant full CPG access to users who are already members of the society. They identify themselves in other ways via email address, which ATM I am manually checking against the database. But CPG doesn't display the user email address, just their username. Is there any way I can modify the activation request to include the users email address?
Title: Re: Display user email address in activation request?
Post by: Nibbler on February 18, 2006, 12:19:54 AM
Register.php, find


                                                        $template_vars = array(
                                                                        '{SITE_NAME}' => $CONFIG['gallery_name'],
                                                                        '{USER_NAME}' => $user_name,
                                                                        '{ACT_LINK}' => $act_link,
                                                        );


Add in a new tag


                                                        $template_vars = array(
                                                                        '{SITE_NAME}' => $CONFIG['gallery_name'],
                                                                        '{USER_NAME}' => $user_name,
                                                                        '{ACT_LINK}' => $act_link,
                                                                        '{EMAIL}' => $email

                                                        );


Edit your lang file (eg. lang/english.php), find


$lang_register_approve_email = <<<EOT
A new user with the username "{USER_NAME}" has registered in your gallery.

In order to activate the account, you need to click on the link below or copy and paste it in your web browser.

<a href="{ACT_LINK}">{ACT_LINK}</a>

EOT;


Add in a new tag


$lang_register_approve_email = <<<EOT
A new user with the username "{USER_NAME}" and email "{EMAIL}" has registered in your gallery.

In order to activate the account, you need to click on the link below or copy and paste it in your web browser.

<a href="{ACT_LINK}">{ACT_LINK}</a>

EOT;


That should work.
Title: Re: Display user email address in activation request?
Post by: lordprodigy on February 18, 2006, 08:10:50 PM
I like this. However I dont have authorisations on but would like to see the email of the person registered in the admin notification. I assume its the same thing and I need to edit this: 'notify_admin_email_body' => 'A new user with the username "%s" has registered in your gallery', but I dont know what to add. thanks.
Title: Re: Display user email address in activation request?
Post by: Nibbler on February 18, 2006, 09:51:51 PM
Add in an extra %s into that string, and then add a new param to the sprintf

cpg_mail('admin', sprintf($lang_register_php_def['notify_admin_email_subject'], $CONFIG['gallery_name']), sprintf($lang_register_php_def['notify_admin_email_body'], $user_name, $email));

Change the order of the params to sprintf to match the order of the %s in the lang var.
Title: Re: Display user email address in activation request?
Post by: lordprodigy on February 18, 2006, 11:03:23 PM
Thank you Nibbler. works great, as you said. I have tested the authorisation email and it works too, so you can mark this solved!
Title: Re: Display user email address in activation request?
Post by: Nibbler on February 18, 2006, 11:05:04 PM
Just because you hijacked a thread and got an answer doesn't mean the thread is solved. ;)
Title: Re: Display user email address in activation request?
Post by: Informator on February 19, 2006, 09:56:40 AM
As it happens, I have tried the above by editing the file remotely and it hasn't worked just yet. But I am not at my current system so will have to wait until tonight when I get back and actually have a proper poke around. Results later - stand by!  :)
Title: Re: Display user email address in activation request?
Post by: Informator on February 21, 2006, 06:59:34 PM
Hi, sorry for the delay. I can confirm that the above has worked absolutely perfectly. Many thanks to Nibbler for such a fast and useful response!