Custom Fields added but registration email does display the custom field value Custom Fields added but registration email does display the custom field value
 

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

Custom Fields added but registration email does display the custom field value

Started by jimmym, December 08, 2011, 07:59:39 AM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

jimmym

I've read these postings and I'm still not able to get it working:
http://forum.coppermine-gallery.net/index.php/topic,39006.msg184822.html#msg184822
http://forum.coppermine-gallery.net/index.php/topic,37086.20.html
http://forum.coppermine-gallery.net/index.php/topic,59101.0.html

My issue is the custom field values does not appear in the (see attached).

In register.php, I've done this:
        foreach($admins as $admin) {
            //check if the admin language is available
            if (file_exists("lang/{$admin['lang']}.php")) {
                $lang_register_php_def = cpg_get_default_lang_var('lang_register_php', $admin['lang']);
                $lang_register_approve_email_def = cpg_get_default_lang_var('lang_register_approve_email', $admin['lang']);
            } else {
                $lang_register_php_def = cpg_get_default_lang_var('lang_register_php');
                $lang_register_approve_email_def = cpg_get_default_lang_var('lang_register_approve_email');
            }
   
            $act_link = rtrim($CONFIG['site_url'], '/') . '/register.php?activate=' . $act_key;

            $template_vars = array(
                '{SITE_NAME}' => $CONFIG['gallery_name'],
                '{USER_NAME}' => $row['user_name'],
                '{ACT_LINK}' => $act_link,
                    '{PROFILE1}' => $profile1,
                    '{PROFILE2}' => $profile2,
                    '{PROFILE3}' => $profile3,
                    '{PROFILE4}' => $profile4,
                    '{PROFILE5}' => $profile5,
            );

            cpg_mail($admin['email'], sprintf($lang_register_php_def['notify_admin_request_email_subject'], $CONFIG['gallery_name']), nl2br(strtr($lang_register_approve_email_def, $template_vars)));


In english.php, I've done this:
$lang_register_approve_email = <<< EOT

A new user with the username "{USER_NAME}" has registered in your gallery.

The information provided are:
Name                   : "{PROFILE1}"
Contact number         : "{PROFILE2}"
Name of child          : "{PROFILE3}"
Child DOB              : "{PROFILE4}"
Relationship with child: "{PROFILE5}"

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;


I couldn't figure out what is wrong. All the fields profile1, profile2, profile3, profile4, profile5 has been populated with values and are not blank.  However the coppermine fields {SITE_NAME}, {USER_NAME} are displaying the field values.

I suspect the variable $profile1, $profile2, $profile3, $profile4, $profile5 is blank.  Perhaps the sql didn't select the values for these variables.

Hope someone can help.

Thanks.

Αndré

Quote from: jimmym on December 08, 2011, 07:59:39 AM
I suspect the variable $profile1, $profile2, $profile3, $profile4, $profile5 is blank.  Perhaps the sql didn't select the values for these variables.
They are empty, because they've never been populated. You have to extend
$sql = "SELECT user_active, user_email, user_email_valid, user_name FROM {$CONFIG['TABLE_USERS']} WHERE user_actkey = '$act_key' LIMIT 1";
and change
'{PROFILEx}' => $profilex,
to
'{PROFILEx}' => $row['user_profilex'],


Αndré

Then, please
Quote from: Joachim Müller on September 28, 2008, 12:46:26 PM
tag your answer as "solved" by clicking on the "Topic Solved" button on the bar at the left hand side at the bottom of your thread.