forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 email => Topic started by: jimmym on December 08, 2011, 07:59:39 am

Title: Custom Fields added but registration email does display the custom field value
Post by: jimmym on December 08, 2011, 07:59:39 am
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,39006.msg184822.html#msg184822)
http://forum.coppermine-gallery.net/index.php/topic,37086.20.html (http://forum.coppermine-gallery.net/index.php/topic,37086.20.html)
http://forum.coppermine-gallery.net/index.php/topic,59101.0.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:
Code: [Select]
        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:
Code: [Select]
$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.
Title: Re: Custom Fields added but registration email does display the custom field value
Post by: Αndré on December 12, 2011, 11:31:14 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
Code: [Select]
$sql = "SELECT user_active, user_email, user_email_valid, user_name FROM {$CONFIG['TABLE_USERS']} WHERE user_actkey = '$act_key' LIMIT 1";and change
Code: [Select]
'{PROFILEx}' => $profilex,to
Code: [Select]
'{PROFILEx}' => $row['user_profilex'],
Title: Re: Custom Fields added but registration email does display the custom field value
Post by: jimmym on December 14, 2011, 01:55:27 pm
Hi Andre!, It worked.  Thanks.
Title: Re: Custom Fields added but registration email does display the custom field value
Post by: Αndré on December 14, 2011, 02:55:14 pm
Then, please
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.