forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 email => Topic started by: heavensportal on April 20, 2012, 04:40:59 am

Title: emailed comments notifications--get in english only
Post by: heavensportal on April 20, 2012, 04:40:59 am
This is the code (from this forum) that I have added to my file to get notifications emailed for gallery image comments...is there somehow a way to add for the person that gets the notification to get them in english?

Right now when a user comments, the reciever gets them but in the commentors preferred language, not the boards set language--English

Code: [Select]
                 
                 $result = cpg_db_query("SELECT filename, title, owner_id FROM {$CONFIG['TABLE_PICTURES']} WHERE pid = $pid LIMIT 1");
            $picture = cpg_db_fetch_rowset($result);
            mysql_free_result($result);
            if ($picture[0]['owner_id'] && $picture[0]['owner_id'] != USER_ID) {
                global $cpg_udb;
                $result = cpg_db_query("SELECT ".$cpg_udb->field['username']." AS user_name, ".$cpg_udb->field['email']." AS user_email FROM ".$cpg_udb->usertable." WHERE ".$cpg_udb->field['user_id']." = {$picture[0]['owner_id']} LIMIT 1");
                $owner = cpg_db_fetch_rowset($result);
                mysql_free_result($result);
                $title = $picture[0]['title'] ? $picture[0]['title'] : $picture[0]['filename'];
                $mail_body = "Your picture '$title' has received a new comment. You can see it at " . ' ' . $CONFIG['ecards_more_pic_target'] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $redirect;
                cpg_mail($owner[0]['user_email'], $lang_db_input_php['email_comment_subject'], make_clickable($mail_body));
            }
           
                    $result = cpg_db_query("SELECT filename, title, owner_id FROM {$CONFIG['TABLE_PICTURES']} WHERE pid = $pid LIMIT 1");
        $picture = cpg_db_fetch_rowset($result);
        mysql_free_result($result);
        if ($picture[0]['owner_id'] != USER_ID) {
            $user_id_array[] = $picture[0]['owner_id'];
        }

        $result = cpg_db_query("SELECT author_id FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid = $pid AND author_id != 0");
        while ($row = mysql_fetch_assoc($result)) {
            if ($row['author_id'] != USER_ID) {
                $user_id_array[] = $row['author_id'];
            }
        }
        mysql_free_result($result);

        if (count($user_id_array)) {
            global $cpg_udb;
            $title = $picture[0]['title'] ? $picture[0]['title'] : $picture[0]['filename'];
            $mail_body = "Your picture '$title' has received a new comment. You can see it at " . ' ' . $CONFIG['ecards_more_pic_target'] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $redirect;
            $result = cpg_db_query("SELECT ".$cpg_udb->field['email']." AS user_email FROM ".$cpg_udb->usertable." WHERE ".$cpg_udb->field['user_id']." IN (".implode(', ', $user_id_array).")");
            while ($row = mysql_fetch_assoc($result)) {
                cpg_mail($row['user_email'], $lang_db_input_php['email_comment_subject'], make_clickable($mail_body));
            }
            mysql_free_result($result);
        }
       
       
Title: Re: emailed comments notifications--get in english only
Post by: Αndré on April 20, 2012, 08:57:28 am
First of all you applied the mod wrongly. This (http://forum.coppermine-gallery.net/index.php/topic,71072.msg349351.html#msg349351) post tells you to replace that (http://forum.coppermine-gallery.net/index.php/topic,71072.msg346255.html#msg346255) modification, not to append it. So please remove the first block in your gallery.


Additionally, the mail body is already hard-coded in English:
Code: [Select]
$mail_body = "Your picture '$title' has received a new comment. You can see it at " . ' ' . $CONFIG['ecards_more_pic_target'] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $redirect;so I assume the mail subject isn't English?
Title: Re: emailed comments notifications--get in english only
Post by: heavensportal on April 20, 2012, 10:51:51 am
OK I went to the file again:

found this one
Code: [Select]
   if ($CONFIG['email_comment_notification'] && !USER_IS_ADMIN ) {
            $mail_body = "<p>" . bb_decode(process_smilies($msg_body, $CONFIG['ecards_more_pic_target'])) . '</p>' . $LINEBREAK .$lang_db_input_php['email_comment_body'] . ' ' . $CONFIG['ecards_more_pic_target'] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $redirect;
            cpg_mail('admin', $lang_db_input_php['email_comment_subject'], make_clickable($mail_body));
        }


then added this after it --- for only the original user to get notified, not everyone that comments

Code: [Select]
$result = cpg_db_query("SELECT filename, title, owner_id FROM {$CONFIG['TABLE_PICTURES']} WHERE pid = $pid LIMIT 1");
            $picture = cpg_db_fetch_rowset($result);
            mysql_free_result($result);
            if ($picture[0]['owner_id'] && $picture[0]['owner_id'] != USER_ID) {
                global $cpg_udb;
                $result = cpg_db_query("SELECT ".$cpg_udb->field['username']." AS user_name, ".$cpg_udb->field['email']." AS user_email FROM ".$cpg_udb->usertable." WHERE ".$cpg_udb->field['user_id']." = {$picture[0]['owner_id']} LIMIT 1");
                $owner = cpg_db_fetch_rowset($result);
                mysql_free_result($result);
                $title = $picture[0]['title'] ? $picture[0]['title'] : $picture[0]['filename'];
                $mail_body = "Your picture '$title' has received a new comment. You can see it at " . ' ' . $CONFIG['ecards_more_pic_target'] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $redirect;
                cpg_mail($owner[0]['user_email'], $lang_db_input_php['email_comment_subject'], make_clickable($mail_body));
            }
       


I was asking about the email notifications to go to the user in English because some are getting -- myself included -- the notifications in a different language (german for instance)

I think I messed it up in the original post here, sorry
Title: Re: emailed comments notifications--get in english only
Post by: Αndré on April 20, 2012, 11:58:19 am
As I already said, the "Email users on new comments" mod has a hard-coded mail body. It's not possible that the mail contains anything different than English text.

Please post the (non-English) content of such an email you're talking about.