Advanced search  

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

Pages: [1]   Go Down

Author Topic: Correctly adding and using the tag '{EMAIL}'  (Read 19868 times)

0 Members and 2 Guests are viewing this topic.

TeacherMac

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Correctly adding and using the tag '{EMAIL}'
« on: December 30, 2012, 09:18:03 pm »

I added the tag '{EMAIL}' to register.php

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

Which works fine when called in the new user's Registration confirmation email:

But does not work when used with the Registration request email received by the administrator.

$lang_register_approve_email = <<< EOT
A new user with the username "{USER_NAME}" and the email address "{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;

And doesn't work with the Activation notification email received by the new user:

$lang_register_php['activated_email'] = <<< EOT

Your account has been approved and activated.

You can now log in at <a href="{SITE_LINK}">{SITE_LINK}</a> using the email address you used to register "{EMAIL}"


Regards,

The management of {SITE_NAME}

EOT;

I just can't seem to find the answer so help would be appreciated.
Logged

TeacherMac

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Correctly adding and using the tag '{EMAIL}'
« Reply #1 on: December 30, 2012, 10:25:00 pm »

I added the tag '{EMAIL}' to register.php

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

Which works fine when called in the new user's Registration confirmation email:

But does not work when used with the Registration request email received by the administrator.

$lang_register_approve_email = <<< EOT
A new user with the username "{USER_NAME}" and the email address "{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;

And doesn't work with the Activation notification email received by the new user:

$lang_register_php['activated_email'] = <<< EOT

Your account has been approved and activated.

You can now log in at <a href="{SITE_LINK}">{SITE_LINK}</a> using the email address you used to register "{EMAIL}"


Regards,

The management of {SITE_NAME}

EOT;

I just can't seem to find the answer so help would be appreciated.
Logged

TeacherMac

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Correctly adding and using the tag '{EMAIL}'
« Reply #2 on: December 30, 2012, 10:27:25 pm »

Appears I posted this in the wrong forum.

I have posted it to the correct forum so please disregard the posting here.

Thanks,

Mac
Logged

TeacherMac

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Correctly adding and using the tag '{EMAIL}'
« Reply #3 on: December 31, 2012, 04:06:12 am »

Seems someone, trying to be helpful, may have inadvertently given the impression that this request for support was answered.

Probably because I originally posted in the wrong forum and tried to resolve that myself.

In short, I would appreciate help in resolving my problem.

Thanks and best wishes to all for the New Year,

Mac
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Correctly adding and using the tag '{EMAIL}'
« Reply #4 on: January 02, 2013, 01:35:01 pm »

Please check if you have added
Code: [Select]
'{EMAIL}'  => $email,to all occurrences of
Code: [Select]
            $template_vars = array(
                '{SITE_NAME}' => $CONFIG['gallery_name'],
                '{USER_NAME}' => $row['user_name'],
                '{ACT_LINK}' => $act_link,
            );
(there are 4 in register.php).
Logged

TeacherMac

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Correctly adding and using the tag '{EMAIL}'
« Reply #5 on: January 02, 2013, 08:25:44 pm »

Hi Andrea and all the best for the New Year!

Yes there are 4 areas that can be changed and here are the results I've documented

Adding '{EMAIL}' to line 624 of the first "$template_vars = array" (located on line 620)

Admin Registration notification email: USER_Name & EMAIL variables display correctly
User Registration confirmation email:  USER_Name & EMAIL variables display correctly
Admin Registration request email: USER_Name displayed correctly but EMAIL variables displayed as "EMAIL"
User Activation notification email:  USER_Name displayed correctly but EMAIL variables displayed as "EMAIL"

Adding '{EMAIL}' to line 675 of the second "$template_vars = array" (located on line 671)

Admin Registration notification email: USER_Name & EMAIL variables display correctly
User Registration confirmation email:  USER_Name & EMAIL variables display correctly
Admin Registration request email: USER_Name displayed correctly but EMAIL variables displayed as "EMAIL"
User Activation notification email:  USER_Name displayed correctly but EMAIL variables displayed as "EMAIL"

Adding '{EMAIL}' to line 764 of the second "$template_vars = array" (located on line 760)

Admin Registration notification email: USER_Name & EMAIL variables display correctly
User Registration confirmation email:  USER_Name & EMAIL variables display correctly
Admin Registration request email: USER_Name displayed correctly but EMAIL variables displayed as "EMAIL"
User Activation notification email:  USER_Name displayed correctly but EMAIL variables displayed as "" (Empty Quotes)

Adding '{EMAIL}' to line 799 of the second "$template_vars = array" (located on line 803)

Admin Registration notification email: USER_Name & EMAIL variables display correctly
User Registration confirmation email:  USER_Name & EMAIL variables display correctly
Admin Registration request email: USER_Name displayed correctly but EMAIL variables displayed as "" (Empty Quotes)
User Activation notification email:  USER_Name displayed correctly but EMAIL variables displayed as "" (Empty Quotes)

I appreciate your time in looking into this matter.

Mac
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Correctly adding and using the tag '{EMAIL}'
« Reply #6 on: January 03, 2013, 10:22:23 am »

If there are empty quotes the token has been replaced successfully, but unfortunately $email is empty/doesn't exist at that point. Maybe the email address exists in another variable/array, if not, you have to get it from the SQL database.
Logged

TeacherMac

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Correctly adding and using the tag '{EMAIL}'
« Reply #7 on: January 03, 2013, 06:01:02 pm »

I do appreciate your pointing out the obvious as I did take the time to try to find an answer.

I finally asked for support here and was actually hoping for some help with the coding, specifically in how to retrieve the information from the database and apply it where I needed it.

I hope someone else might be able to help.

Have a good year.

Thanks for our help,

Mac
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Correctly adding and using the tag '{EMAIL}'
« Reply #8 on: January 03, 2013, 07:28:58 pm »

If your gallery is unbridged, something like
Code: [Select]
$email = mysql_result(cpg_db_query("SELECT user_email FROM {$CONFIG['TABLE_USERS']} WHERE user_name = '{$row['user_name']}' LIMIT 1"), 0);should populate the $email variable. As I haven't tested the code it may contain typos. Please add it above $template_vars = array( and report if it works as expected.
Logged

TeacherMac

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Correctly adding and using the tag '{EMAIL}'
« Reply #9 on: January 03, 2013, 10:52:14 pm »

Thank you André! :D

That's the help I needed and the code worked fine ( no typos I guess lol)

To help others who may appreciate this, I inserted the code you provided: "$email = mysql_result(cpg_db_query("SELECT user_email FROM {$CONFIG['TABLE_USERS']} WHERE user_name = '{$row['user_name']}' LIMIT 1"), 0);"

before "$template_vars = array( " in the file register.php which is located in the root directory which only had to be done in two locations as shown below.

 The code inserted on (my line 759) enabled the variable "EMAIL" to be displayed correctly in the user's "Activation notification" email.
 
(755) //after admin approves, user receives email notification
(756)    if ($user_status == 'active_admin') {
(757)   
(758)        msg_box($lang_register_php['information'], $lang_register_php['acct_active_admin_activation'], $lang_common['continue'], 'index.php');
(759)$email = mysql_result(cpg_db_query("SELECT user_email FROM {$CONFIG['TABLE_USERS']} WHERE user_name = '{$row['user_name']}' LIMIT 1"), 0);
(760)       $template_vars = array(
(761)            '{SITE_LINK}' => $CONFIG['site_url'],
(762)            '{USER_NAME}' => $row['user_name'],
(763)            '{SITE_NAME}' => $CONFIG['gallery_name'],
(764)             '{EMAIL}'  => $email,
(765)
(766)        );
      
The code inserted on (my line 799) enabled the variable "EMAIL" to be displayed correctly in the administrator's "Registration request" email.
      
(798)            $act_link = rtrim($CONFIG['site_url'], '/') . '/register.php?activate=' . $act_key;
(799)$email = mysql_result(cpg_db_query("SELECT user_email FROM {$CONFIG['TABLE_USERS']} WHERE user_name = '{$row['user_name']}' LIMIT 1"), 0);
(800)            $template_vars = array(
(801)                '{SITE_NAME}' => $CONFIG['gallery_name'],
(802)                '{USER_NAME}' => $row['user_name'],
(803)                '{ACT_LINK}' => $act_link,
(804)                '{EMAIL}'  => $email
(805)            );

Thanks again for your assistance and please mark this as SOLVED!

Mac
 
Logged

phill104

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4885
    • Windsurf.me
Re: Correctly adding and using the tag '{EMAIL}'
« Reply #10 on: January 03, 2013, 11:23:09 pm »

Marking as solved is only omething you can do as the thread starte ;)

Thanks for showing us your completed work, it always comes in handy helping others.
Logged
It is a mistake to think you can solve any major problems just with potatoes.
Pages: [1]   Go Up
 

Page created in 0.04 seconds with 21 queries.