Author Topic: [Mod] Email image validation results to the user  (Read 46105 times)

0 Members and 1 Guest are viewing this topic.

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Mod] Email image validation results to the user
« on: January 16, 2003, 11:46:00 PM »
I've made this small MOD on my users request. They were waiting for their photo validation, without knowing if it was declined. The idea and some code are from Vraxor (mail on comments MOD).
Code: [Select]
#############################################################################################
## Title: Email image validation results to the user
##        for 4images - Image Gallery Management System.
##
## Version: 1.0
## Author: Silly Little Lamer <sll@dalnet.ru>
## Description: This Mod sends the email to the users, informing them if uploaded
## image(s) were validated or declined by the Administrator of the Gallery.
##        Email being sent only to the users, which have "Receive emails from
## administrators" set "on"
##
## Installation Level: Easy
## Installation Time: 5 Minutes
##
## Files To Edit: 1
## /4images/admin/validateimages.php
##
#############################################################################################
download: http://faces.dalnet.ru/files.php?id=7&l=english
« Last Edit: April 09, 2005, 01:13:48 AM by V@no »

Offline heiko

  • Newbie
  • *
  • Posts: 42
    • View Profile
:-) Thanx for the MOD
« Reply #1 on: January 17, 2003, 02:42:07 AM »
Cooles und nützliches MOD für 4images.  :lol:

Allerdings mußte ich folgende Modifikation vornehmen, da ansonsten
der Link zum Bild  in der Bestätigungsmail (bei erfolgreicher Freigabe) nicht korrekt wiedergegeben wird.

$image_url = $cut_url."details.php?".URL_IMAGE_ID."=".$image_id."";

ändern zu:

$image_url = $cut_url."/details.php?".URL_IMAGE_ID."=".$image_id."";

                               ^^^^^



und nochmals Danke


Gruss Heiko

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
Re: :-) Thanx for the MOD
« Reply #2 on: January 17, 2003, 09:39:29 AM »
Quote from: heiko
Allerdings mußte ich folgende Modifikation vornehmen, da ansonsten der Link zum Bild  in der Bestätigungsmail (bei erfolgreicher Freigabe) nicht korrekt wiedergegeben wird.


Well... I'm a bit confused myself  :roll:

Theoretically you're right, but if I do it this way, I've got double slash in this link... I've checked it on my local test gallery (OMHIhttpd with WinPHP), and then on my running gallery (Apache, Linux) - in both cases my first code works fine.

So, I believe, this is up to this MOD users to experiment, which of the varians of this line will works for them.

BTW, could you please email me the German text for these templates? I'll include it in the code. Also, if somebody could correct my silly English up there in the templates, that would be also good  :)

Offline Jasondavis

  • Full Member
  • ***
  • Posts: 157
    • View Profile
help!
« Reply #3 on: February 02, 2003, 01:57:47 AM »
Image deleted: 43ef (HQ0.JPG)

Email Error: Couldn't open Template ./../lang/english/email/declined_email.html


I get this error any ideas?

Offline Jasondavis

  • Full Member
  • ***
  • Posts: 157
    • View Profile
fixed
« Reply #4 on: February 02, 2003, 02:41:41 AM »
Hi, it was an error on my part....the email files were named .htm instead of .html

Offline ai-gu

  • Newbie
  • *
  • Posts: 29
    • View Profile
[Mod] Email image validation results to the user
« Reply #5 on: April 16, 2003, 02:52:27 PM »
Hi all,
My 4images was integrated with phpBB, and I tried to install this MOD, after I did all as instructed in here, I got this error:

Quote
Image added: test (cbnu.JPG)

DB Error: Bad SQL Query: SELECT user_email, user_name, user_allowemails FROM phpbb202_users WHERE user_id = 4
Unknown column 'user_name' in 'field list'


I would appreciate if any one could help me out this problem.
Thanks in advance.

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Mod] Email image validation results to the user
« Reply #6 on: April 16, 2003, 03:29:44 PM »
just check phpbb field names and change this query accordingly

Offline ai-gu

  • Newbie
  • *
  • Posts: 29
    • View Profile
[Mod] Email image validation results to the user
« Reply #7 on: April 16, 2003, 04:50:50 PM »
Hi all,

Thanks SLL I changed the field names and there was no Error. But it seems that no mail was sent. The problem may be at the red colored text. (most of the e-mail addresses at the phpBB forum are not viewable by users (user_viewemail).

Can you guide me to change the code so that whoever post an image will receive the mail upon validation or decline??


Quote
$current_time = time();
   $row = array();
   $sql = "SELECT user_email, username, user_viewemail FROM ".USERS_TABLE." WHERE user_id = $user_id";
   $result = $site_db->query($sql);
   $row = $site_db->fetch_array($result);
   $user_allowemails = ($row['user_viewemail']);   $recipient_email = ($row['user_email']);
   $recipient_name = ($row['username']);
   $cut_url = str_replace("admin", "", $script_url);
   $image_url = $cut_url."details.php?".URL_IMAGE_ID."=".$image_id."";

   if ($user_allowemails == 1) {
   $site_email = new Email();
   $site_email->set_to($recipient_email);
   $site_email->set_from($config['site_email'], $config['site_name']);
   $site_email->set_subject("Image Validation Results");
   $site_email->register_vars(array(
   "recipient_name" => $recipient_name,
   "lang_image_add_success" => $lang['image_add_success'],
   "validation_date" => format_date($config['date_format']." ".$config['time_format'], $current_time),
   "site_name" => $config['site_name'],
   "yr_image_name" => strtoupper($image_media_file),
   "image_url" => $image_url,
   ));
   $site_email->set_body("validation_email", $config['language_dir']);
   $site_email->send_email();
   }
//-------------------------------------------------------

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Mod] Email image validation results to the user
« Reply #8 on: April 16, 2003, 09:27:20 PM »
just remove these two lines and } bracket at the very end.

Offline eXup

  • Newbie
  • *
  • Posts: 14
    • View Profile
    • http://www.KartPoint.com
[Mod] Email image validation results to the user
« Reply #9 on: June 16, 2003, 09:43:01 AM »
Hi all,

der Mod ist wirklich sehr nützlich.

Könnte man ihn so umbauen, dass der Uploader beim Upload definieren kann ob er die
"Validation-E-Mail" erhalten will oder nicht? Meine Gedanken dazu: Man müsste ein Auswahlfeld
in die Uploadmaske einfügen und beim Validieren fallabhängig die E-Mail schicken.

Leider geht das aber eindeutig über meinen Horizont. Wäre nett, wenn es jemandem gelingen würde
diese Modifikation einzubauen.
eXup
A straight road is only a connection between two curves...

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Mod] Email image validation results to the user
« Reply #10 on: June 16, 2003, 10:18:02 AM »
there's no need to change anything. as you can see, the line if ($user_allowemails == 1) checks, if user set "allow emails from admin" in his profile. this setting is effective for all emails, including those sent by this mod too.

Offline CrEaTi0n

  • Pre-Newbie
  • Posts: 6
    • View Profile
    • http://www.planetmars.za.net
[Mod] Email image validation results to the user
« Reply #11 on: June 18, 2003, 12:59:57 PM »
Hi,

I have integrated 4Images with Invision Board. It works well. I have just added this mod. Now, i cant figure out what it wrong with it.

The code as it stands:
Quote

// Validated picture message --------------------------
//-----------------------------------------------------

        $current_time = time();
        $row = array();
        $sql = "SELECT user_email, user_name, user_allowemails FROM ".USERS_TABLE." WHERE user_id = $user_id";
        $result = $site_db->query($sql);
        $row = $site_db->fetch_array($result);
        $user_allowemails = ($row['user_allowemails']);
        $recipient_email = ($row['user_email']);
        $recipient_name = ($row['user_name']);
        $cut_url = str_replace("admin", "", $script_url);
        $image_url = $cut_url."details.php?".URL_IMAGE_ID."=".$image_id."";

        if ($user_allowemails == 1) {
        $site_email = new Email();
        $site_email->set_to($recipient_email);
        $site_email->set_from($config['site_email'], $config['site_name']);
        $site_email->set_subject("Image Validation Results");
        $site_email->register_vars(array(
        "recipient_name" => $recipient_name,
        "lang_image_add_success" => $lang['image_add_success'],
        "validation_date" => format_date($config['date_format']." ".$config['time_format'], $current_time),
        "site_name" => $config['site_name'],
        "yr_image_name" => strtoupper($image_media_file),
        "image_url" => $image_url,
        ));
        $site_email->set_body("validation_email", $config['language_dir']);
        $site_email->send_email();
        }
//-------------------------------------------------------


Now, in Invision Board, we have a few different fields, namely.

user_email is just email
user_name is just name
user_allowemails could be one of two: allow_admin_emails or email_full (both of wich are toggled with a 1 or a 0)
user_id is just id

Now, i replaced all of those. And i dont get an error message. Just nothing happens. No mail gets send, and the image is added to the gallery.

Any insight would be helpfull.

I havent posted the Declined code, because if this gets sorted, then im sure i can sort that...

Thanks.

Ian

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[Mod] Email image validation results to the user
« Reply #12 on: June 18, 2003, 02:01:17 PM »
u must do steps from integration guide again for this mod.
for example as u said user_id now is id then, look through the mod and replace all u can find with corrected names. (i.e. $row['user_email'] should be $row['email'] )
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline CrEaTi0n

  • Pre-Newbie
  • Posts: 6
    • View Profile
    • http://www.planetmars.za.net
[Mod] Email image validation results to the user
« Reply #13 on: June 18, 2003, 04:51:09 PM »
Hi,

i did all that. but nothing happends when you do that. When you validate an image, no mail is sent off.


Ian

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Mod] Email image validation results to the user
« Reply #14 on: June 18, 2003, 09:47:51 PM »
you should post ib adopted (not original) mod code here, maybe we'll see something you've missed