Additional Fields in Admin Notification Additional Fields in Admin Notification
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Additional Fields in Admin Notification

Started by UrOnline, December 03, 2006, 10:36:18 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

UrOnline

I would like to get some additional fields in the notification e-mail to the admin that a new user has joined the gallery.

I would like to get the User Name, Email Address, and Persons name (which is the Optional Field 1).

I saw this post http://forum.coppermine-gallery.net/index.php?topic=37086.msg175005#msg175005.

It seems that this will only work if the "Admin activation of registrations" is enabled.

Since I don't require Admin activations of e-mail, I persume that I will have to change this line (Approx line #1538) in english.php

'notify_admin_email_body' => 'A new user with the username "%s" has registered in your gallery',

I'm not sure if changing this will be enough and what are the fields are that I have to put in.

Thanks.

UrOnline

This is what I did so far:

In register.php I added some lines (around line # 312), Please check the end of the last line because that might be wrong (also '{USER_FULLNAME}' => $profile1 this might be wrong as well) .

                                        if ($CONFIG['admin_activation']==1) {
                                                        $act_link = rtrim($CONFIG['site_url'], '/') . '/register.php?activate=' . $act_key;
                                                        $template_vars = array(
                                                                        '{SITE_NAME}' => $CONFIG['gallery_name'],
                                                                        '{USER_NAME}' => $user_name,
                                                                        '{ACT_LINK}' => $act_link,
                                                                        '{EMAIL}' => $email,
                                                                        '{USER_FULLNAME}' => $profile1
                                                        );
                                                        cpg_mail('admin', sprintf($lang_register_php_def['notify_admin_request_email_subject'], $CONFIG['gallery_name']), nl2br(strtr($lang_register_approve_email_def, $template_vars)));
                                        } else {
                                                        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, $profile1));


In english.php I added more "%s" (line # 1538, approx).
'notify_admin_email_body' => 'A new user with the username: "%s", email: "%s", and Name: "%s" has registered in your gallery',


Now in the email I get:

A new user with the username: "test", email: "test@test.net", and Name: "" has registered in your gallery

I can't seem to get the profile field to work.

UrOnline

Now I feel stupid  :-[

I backup up my database today and while looking through it I notice that some of the names were in Profile1 and some were in Profile5.

When I was trying one of the solutions that I found in this forum I switched my field to Profile5. In all the code that I was using I'm looking at Profile1. So of course it wasn't working - as Profile 1 is blank. After switching my optional field in Config back to Profile1 it works fine.

I learned from this to always triple check all the settings and code. I hope others will learn as well.

Thanks for the awesome product! :)

Stramm

thanks for posting the solution to your problem... most of us learned it the 'hard way' and it can't be said enough to double and triple check everything