Advanced search  

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]

Pages: [1]   Go Down

Author Topic: Additional Fields in Admin Notification  (Read 4861 times)

0 Members and 1 Guest are viewing this topic.

UrOnline

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Additional Fields in Admin Notification
« on: December 03, 2006, 10:36:18 am »

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.
« Last Edit: December 04, 2006, 07:39:11 pm by Stramm »
Logged

UrOnline

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Re: Additional Fields in Admin Notification
« Reply #1 on: December 03, 2006, 08:44:40 pm »

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) .

Code: [Select]
                                        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).
Code: [Select]
'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.
Logged

UrOnline

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Re: Additional Fields in Admin Notification
« Reply #2 on: December 04, 2006, 07:36:19 pm »

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! :)
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Additional Fields in Admin Notification
« Reply #3 on: December 04, 2006, 07:41:12 pm »

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
Pages: [1]   Go Up
 

Page created in 0.017 seconds with 19 queries.