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

0 Members and 1 Guest are viewing this topic.

Offline CrEaTi0n

  • Pre-Newbie
  • Posts: 6
    • View Profile
    • http://www.planetmars.za.net
[Mod] Email image validation results to the user
« Reply #15 on: June 21, 2003, 07:15:10 AM »
Hi,

This is my code as it stands at the moment:

Quote

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

        $current_time = time();
        $row = array();
        $sql = "SELECT email, name, allow_admin_mails FROM ".USERS_TABLE." WHERE id = $user_id";
        $result = $site_db->query($sql);
        $row = $site_db->fetch_array($result);
        $user_allowemails = ($row['allow_admin_mails']);
        $recipient_email = ($row['email']);
        $recipient_name = ($row['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();
        }
//-------------------------------------------------------


//-----------------------------------------------------
// Declined picture message ---------------------------
//-----------------------------------------------------

        $row = array();
        $sql = "SELECT email, name, allow_admin_mails FROM ".USERS_TABLE." WHERE id = $user_id";
        $result = $site_db->query($sql);
        $row = $site_db->fetch_array($result);
        $user_allowemails = ($row['allow_admin_mails']);
        $recipient_email = ($row['email']);
        $recipient_name = ($row['name']);

        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_delete_success" => $lang['image_delete_success'],
        "site_name" => $config['site_name'],
        "yr_image_name" => strtoupper($image_media_file),
        ));
        $site_email->set_body("declined_email", $config['language_dir']);
        $site_email->send_email();
        }
//-------------------------------------------------------


I hope someone can help!

Thanks alot.

Ian

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Mod] Email image validation results to the user
« Reply #16 on: June 21, 2003, 10:32:05 AM »
hmm... looks ok  :roll:

i'd suggest you to temporarily put echo commands after each variable  (like echo $recipient_email; ) and debug script this way. then at least you'll see what is taken from db and hopefully find out what's wrong

Offline CrEaTi0n

  • Pre-Newbie
  • Posts: 6
    • View Profile
    • http://www.planetmars.za.net
[Mod] Email image validation results to the user
« Reply #17 on: June 23, 2003, 03:33:49 PM »
Hi,

Could you show me what you mean. I cant get it right, everytime i put an echo somewhere i get lots of errors.

Could you maybee just show me in the code that I posted before?

Thanks
Ian

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Mod] Email image validation results to the user
« Reply #18 on: June 23, 2003, 04:08:00 PM »
something like
Code: [Select]
$recipient_email = ($row['email']);
echo $recipient_email;
$recipient_name = ($row['name']);
echo $recipient_name;

...for all variables. of course you'll see a lot of "garbage", but this way can debug what's going on

Offline CrEaTi0n

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

I cant seem to see anything wrong.

Here is my config:

Quote

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

   $current_time = time();
   echo $current_time;
   $row = array();
   echo $row;
   $sql = "SELECT email, name, allow_admin_mails FROM ".USERS_TABLE." WHERE id = $user_id";
   echo $sql;
   $result = $site_db->query($sql);
   echo $result;
   $row = $site_db->fetch_array($result);
   echo $row;
   $user_allowemails = ($row['allow_admin_mails']);
   echo $user_allowemails;
   $recipient_email = ($row['email']);
      echo $recipient_email;
   $recipient_name = ($row['name']);
   echo $recipient_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();
   echo $site_email;
   $site_email->set_to($recipient_email);
   echo $site_email;
   $site_email->set_from($config['site_email'], $config['site_name']);
   echo $site_email;
   $site_email->set_subject("Image Validation Results");
   echo $site_email;
   $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();
   }
//-------------------------------------------------------


and here is what i get in my browser:

Quote

Image added: Sinfest - Agent (sf20030526.gif)
1056379035ArraySELECT email, name, allow_admin_mails FROM ibf_members WHERE id = 827Resource id #34Arrayian@cerebellum.za.netCrEaTi0n


Any ideas ?

Ian

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Mod] Email image validation results to the user
« Reply #20 on: June 23, 2003, 04:50:41 PM »
WHERE id = $user_id";  query seems to be an error.

827Resource id #34 is definatelly wrong user id

Offline CrEaTi0n

  • Pre-Newbie
  • Posts: 6
    • View Profile
    • http://www.planetmars.za.net
[Mod] Email image validation results to the user
« Reply #21 on: June 23, 2003, 05:29:38 PM »
Hi,

okay. I changed user_id to just id to match the db. But this is still the output i get. It seems as though it sees me as a guest, but i am logged in as administrator.

Quote

1056381796ArraySELECT email, name, allow_admin_mails FROM ibf_members WHERE id = 0Resource id #34Arrayguest@ibforums.comGuest


any ideas?

Ian

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Mod] Email image validation results to the user
« Reply #22 on: June 23, 2003, 05:39:34 PM »
Quote from: CrEaTi0n
any ideas?


nope... i don't use any integration, so the only chance for you is to dig yourself, sorry

Offline rjp123

  • Pre-Newbie
  • Posts: 8
    • View Profile
Re: [Mod] Email image validation results to the user
« Reply #23 on: May 25, 2005, 02:03:27 PM »
Does this bad guy work with 1.7.1?

Thanks.

Offline TIMT

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Re: [Mod] Email image validation results to the user
« Reply #24 on: May 29, 2005, 03:51:21 PM »
Hi

There is no validation e-Mail sent. Why???

May be because in the ACP, user administration, the flag "Receving Mails from the Administrator" ist not "YES"!!   :wink:

Serge