forum.coppermine-gallery.net
Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: mr5 on August 22, 2012, 11:09:43 am
-
Hi, couldn't find the answer to that.
Lately some (probably unwanted) users have registered into my gallery. I would like to compare their IP addresses. For that it would be very useful to add IP address to the notification msg, like: "A new user with the username "nn" (IP=xxxxx) has registered in your gallery".
Thanks
-
There are a couple of files that need to be edited to accoplish this.
First edit your lang file. ie: lang/english.php
Find:
$lang_register_approve_email = <<< EOT
add
IP: {RAW_IP}
wherever you want inside of the heredoc, the EOT tags.
Next edit register.php.
Find:
function check_user_info(&$error)
In the global variables add $raw_ip
global $lang_register_user_login, $lang_errors, $raw_ip;
In the same function
Find this twice:
$template_vars = array(
'{SITE_NAME}' => $CONFIG['gallery_name'],
'{USER_NAME}' => $user_name,
'{ACT_LINK}' => $act_link,
);
and replace with:
$template_vars = array(
'{SITE_NAME}' => $CONFIG['gallery_name'],
'{USER_NAME}' => $user_name,
'{ACT_LINK}' => $act_link,
'{RAW_IP}' => $raw_ip,
);
-
Thanks a lot Jeff !!! http://forum.coppermine-gallery.net/Smileys/default/smiley.gif
-
Sorry to come back to this. The fix probably works when registration needs admin approval. But in my case the admin does not have to approve and it looks that we don't reach $lang_register_approve_email = <<< EOT line.
Thanks.
-
Try this.
In lang/english.php
Find:
$lang_register_php['notify_admin_email_body'] = 'A new user with the username "%s" has registered in your gallery';
Change to:
$lang_register_php['notify_admin_email_body'] = 'A new user with the username "%s" with an IP of %s has registered in your gallery';
In register.php (the same function as the last post function check_user_info(&$error))
Find
cpg_mail($admin['email'], sprintf($lang_register_php_def['notify_admin_email_subject'], $CONFIG['gallery_name']), sprintf($lang_register_php_def['notify_admin_email_body'], $user_name));
replace with
cpg_mail($admin['email'], sprintf($lang_register_php_def['notify_admin_email_subject'], $CONFIG['gallery_name']), sprintf($lang_register_php_def['notify_admin_email_body'], $user_name, $raw_ip));
make sure you leave $raw_ip in the functions global varabiles.
-
:) Thanks Jeff, bot cases work!
-
Glad it worked for you. Please resolve your thread.
http://forum.coppermine-gallery.net/index.php/topic,55415.msg270631.html#msg270631
-
Sorry to bump this thread, but I'm interested in the same feature and made the above mentioned edits to the corresponding files (language files / register.php). Unfortunately, it's not working as it should since the variable for the ip address isn't resolved and I only see "IP: {RAW_IP}" (in plain text) in the confirmation message. Has anyone an idea what goes wrong here?
-
Reread the thread, looks like you missed this part.
Edit register.php.
Find:
function check_user_info(&$error)
In the global variables add $raw_ip
global $lang_register_user_login, $lang_errors, $raw_ip;
In the same function
Find this twice:
$template_vars = array(
'{SITE_NAME}' => $CONFIG['gallery_name'],
'{USER_NAME}' => $user_name,
'{ACT_LINK}' => $act_link,
);
and replace with:
$template_vars = array(
'{SITE_NAME}' => $CONFIG['gallery_name'],
'{USER_NAME}' => $user_name,
'{ACT_LINK}' => $act_link,
'{RAW_IP}' => $raw_ip,
);
Please start your own threads and post a link in the future.
http://forum.coppermine-gallery.net/index.php?index.php/topic,55415.0.html