• [MOD] - Comments notify foreach user in details by email 3 0 5 1
Currently:  

Author Topic: [MOD] - Comments notify foreach user in details by email  (Read 146802 times)

0 Members and 1 Guest are viewing this topic.

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
[MOD] - Comments notify foreach user in details by email
« on: August 26, 2007, 03:01:45 AM »
Hi,

This MOD is for notify comment previous user for reply in details. Stats include for admin - see how user clicked in certain time.

1 - Make backup of gallery

2 - Here is MOD - (test in 4images v1.7.4):

// Step 1

In details.php file,

find:

Code: [Select]
$additional_sql = "";
if (!empty($additional_image_fields)) {
  foreach ($additional_image_fields as $key => $val) {
    $additional_sql .= ", i.".$key;
  }
}

add after:

Code: [Select]
// MOD: Notify comments by email.
 if (function_exists('get_comments_notify_by_email')) {
     get_comments_notify_by_email($user_info['user_id'], 'check_table');    
 }
 // End of MOD: Notify comments by email.

Find:

Code: [Select]
unset($comments);

add after:

Code: [Select]
// MOD: Notify comments by email.
      $sql = "SELECT cn.field_id, cn.comment_notify_status
              FROM " . COMMENTS_NOTIFY_TABLE . " cn
              LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = cn.user_id)
              WHERE cn.image_id = " . $image_id . " AND cn.user_id = " . $user_info['user_id'] . " AND " . get_user_table_field("u.", "user_level") . " >= '" . USER . "'";
              
      $result1 = $site_db->query($sql);
      
      while ($notify_row = $site_db->fetch_array($result1)) {
          $field_id = $notify_row['field_id'];
          $comment_notify_status = $notify_row['comment_notify_status'];
      }

Find:

Code: [Select]
update_comment_count($id, $user_info['user_id']);

add after:

Code: [Select]
// MOD: Comments notify by email.
      if (function_exists('get_comments_notify_by_email')) {
          get_comments_notify_by_email($user_info['user_id'], 'notify');
          $msg = preg_replace("/" . $site_template->start . "user_name" . $site_template->end . "/siU", format_text(stripslashes($user_info['user_name']), 2), $lang['comments_notify_reply_message_email_sent']);
      }
      // End of MOD: Comments notify by email.

Find:

Code: [Select]
unset($row);
unset($spam_row);
}

add after:

Code: [Select]
// MOD: Comments notify by email.
//-----------------------------------------------------
//--- Update Comments Notify by Email -----------------
//-----------------------------------------------------
if ($action == "update_comment_notify_email") {    
    
    $field_id = (isset($HTTP_POST_VARS['field_id'])) ? intval(trim($HTTP_POST_VARS['field_id'])) : 0;    
    $notify_status = (isset($HTTP_POST_VARS['notify_status'])) ? intval(trim($HTTP_POST_VARS['notify_status'])) : "";
    
    if (!isset($field_id) || (isset($field_id) && empty($field_id))) {
        redirect($url);
    }
    
    $date = date('Y-m-d');
    $time = date('H:i:s');
    $microtime = time();      
    
    if (isset($notify_status) && $notify_status == 1) {
        $sql = "UPDATE " . COMMENTS_NOTIFY_TABLE . " SET comment_notify_status = comment_notify_status - 1, comment_notify_date = '" . $date . "', comment_notify_time = '" . $time . "', comment_notify_microtime = '" . $microtime . "' WHERE field_id = " . $field_id;
    } elseif (isset($notify_status) && $notify_status == 0) {        
        $sql = "UPDATE " . COMMENTS_NOTIFY_TABLE . " SET comment_notify_status = comment_notify_status + 1, comment_notify_date = '" . $date . "', comment_notify_time = '" . $time . "', comment_notify_microtime = '" . $microtime . "' WHERE field_id = " . $field_id;
    }
    $result = $site_db->query($sql);
    
    if ($notify_status == 0) {
        $msg = preg_replace("/" . $site_template->start . "user_name" . $site_template->end . "/siU", format_text(stripslashes($user_info['user_name']), 2), $lang['comments_notify_update_notification_uncheck_message']);
    } elseif ($notify_status == 1) {
        $msg = preg_replace("/" . $site_template->start . "user_name" . $site_template->end . "/siU", format_text(stripslashes($user_info['user_name']), 2), $lang['comments_notify_update_notification_check_message']);
    }      
    
    if (preg_match("/comments_notify.php/", $url)) {
        redirect("comments_notify.php");
    } else {    
        redirect("details.php?image_id=" . $image_id);
    }
}
// End of MOD: Comments notify by email.

Find:

Code: [Select]
"lang_file_size" => $lang['file_size']

Replace:

Code: [Select]
// MOD: Notify comments by email.
  "lang_file_size" => $lang['file_size'],
  "comment_notify_button" => (isset($comment_notify_status) && $comment_notify_status == 1) ? get_gallery_image("notify_check.gif") : get_gallery_image("notify_uncheck.gif"),
  "comment_notify_value" => (isset($comment_notify_status) && $comment_notify_status == 1) ? 1 : 0,
  "field_id" => (isset($field_id)) ? (int)$field_id : 0,
  "url_comment_notify_email" => $site_sess->url(ROOT_PATH . "details.php")
  // End of MOD: Notify comments by email.

// Step 2

In includes/constants.php file,

top of ?> - add:

Code: [Select]
// MOD: Comments notify by email.
// Comments notify by email.
define('COMMENTS_NOTIFY_DEBUG_ID', false); // Set true for debug comments reply to your current User ID.
define('COMMENTS_NOTIFY_OVERWRITE_BUTTON_STATUS', true); // Set true for remove each SQL content status from comments_notify.php file (NO RECOVER !). If set false, user can use button again.

// Comments notify by email - statistics
define('COMMENTS_NOTIFY_STATS_TIME_GLOBAL', true); // Activate = true / De-activate = false.
define('COMMENTS_NOTIFY_STATS_TIME', 7); // Set number of day before send stats email to you.
// End of MOD: Comments notify by email.

// Step 3

In includes/functions.php file,

top of ?> - add:

Code: [Select]
// MOD: Comments notify by email.
function get_comments_notify_by_email($user_id = -1, $status = "") {
    global $site_db, $lang, $msg, $user_info, $config, $site_template, $additional_user_fields, $additional_image_fields;
    global $image_id, $id, $table_prefix, $user_table_fields, $script_url;    

    if (!isset($user_id) || $user_id == -1) {
        return;
    }    

    if (!isset($status) || $status == "") {
        return;
    }    

    if (isset($user_id) && $user_id > 0) {
        $user_id = preg_replace("/[^0-9]+/is", "", $user_id);
        if ($user_row = get_user_info($user_id)) {
            if ($user_id != $user_row[$user_table_fields['user_id']]) {
                return;
            }
            unset ($user_row);
        }
        $status = preg_replace("/[^A-Za-z0-9\_]+/is", "", $status);        

        $date = date('Y-m-d');
        $time = date('H:i:s');
        $microtime = time();      

        switch($status) {            

            case 'check_table' :            

            if (!defined('COMMENTS_NOTIFY_TABLE')) {                                
                define('COMMENTS_NOTIFY_TABLE', $table_prefix . "comments_notify");
            }              

                $sql = "                

                CREATE TABLE IF NOT EXISTS " . COMMENTS_NOTIFY_TABLE . " (
                field_id INT(11) NOT NULL AUTO_INCREMENT,
                user_id VARCHAR(32) NOT NULL DEFAULT '0',
                image_id INT(11) NOT NULL DEFAULT '0',
                comment_notify_date VARCHAR(48) NOT NULL DEFAULT '0000-00-00',
                comment_notify_time VARCHAR(48) NOT NULL DEFAULT '00:00:00',
                comment_notify_microtime VARCHAR(255) NOT NULL DEFAULT '0',
                comment_notify_status INT(1) NOT NULL DEFAULT '0',
                PRIMARY KEY (field_id)
                ) TYPE=MyISAM;              

                ";              

                $result = $site_db->query($sql);

                $sql = "SELECT user_id, image_id FROM " . COMMENTS_NOTIFY_TABLE . " WHERE user_id = " . $user_id . " AND image_id = " . $image_id;
                $result = $site_db->query($sql);
                $num_rows = $site_db->get_numrows($result);
                
                if (isset($num_rows) && $num_rows <= 0) {

                    $sql1 = "                  

                    INSERT INTO " . COMMENTS_NOTIFY_TABLE . "
                    (field_id, user_id, image_id, comment_notify_date, comment_notify_time, comment_notify_microtime, comment_notify_status)
                    VALUES (NULL, '" . $user_id . "', '" . $image_id . "', '" . $date . "', '" . $time . "', '" . $microtime . "', '1')                    

                    ";                  

                    $result = $site_db->query($sql1);                    
                }
                
                return $user_id;
                break;                  

                case 'notify' :                

                $additional_user_sql = "";
                $additional_user_sql_array = array();                
                if (isset($additional_user_fields) && is_array($additional_user_fields) && !empty($additional_user_fields)) {
                    foreach ($additional_user_fields as $key => $val) {
                        $additional_user_sql .= ", u." . $key;
                        $additional_user_sql_array[] = $key;
                    }
                }                

                $additional_image_sql = "";
                $additional_image_sql_array = array();
                if (isset($additional_image_fields) && is_array($additional_image_fields) && !empty($additional_image_fields)) {
                    foreach ($additional_image_fields as $key => $val) {
                        $additional_image_sql .= ", i." . $key;
                        $additional_image_sql_array[] = $key;
                    }
                }
                $debug_id = (defined('COMMENTS_NOTIFY_DEBUG_ID') && COMMENTS_NOTIFY_DEBUG_ID == true && isset($user_id) && $user_info['user_level'] == ADMIN) ? "AND cn.user_id = " . $user_info['user_id'] : "";                

            $sql = "            

            SELECT c.comment_headline" . get_user_table_field(", u.", "user_name") . get_user_table_field(", u.", "user_email") . $additional_user_sql . $additional_image_sql . "
            FROM (" . IMAGES_TABLE . " i, " . COMMENTS_TABLE . " c, " . COMMENTS_NOTIFY_TABLE . " cn)
            LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = cn.user_id)
            WHERE cn.image_id = " . $id . " AND c.user_id = " . $user_id . " AND cn.user_id <> " . $user_id . ((isset($debug_id)) ? trim($debug_id) : "") . " AND " . get_user_table_field("u.", "user_level") . " >= '" . USER . "' AND cn.comment_notify_status = 1
            ORDER BY cn.comment_notify_date, cn.comment_notify_time ASC";
    
            $result = $site_db->query($sql);
            $num_rows = $site_db->get_numrows($result);            

            if (isset($num_rows) && $num_rows > 0) {              

                $subject_counter = 0;
                while ($notify_row = $site_db->fetch_array($result)) {
                    $subject_counter++;
                    $user_name = $notify_row[$user_table_fields['user_name']];
                    $user_email = $notify_row[$user_table_fields['user_email']];
                    $reply_subject = $notify_row['comment_headline'];
                }

                

                if (isset($site_email) && !empty($site_email)) {
                    unset ($site_email);
                }
                @include_once(ROOT_PATH . "includes/email.php");
                $site_email = new Email();              

                $site_email->set_to(stripslashes($user_email));
                $site_email->set_from(stripslashes($config['site_email']));
$site_email->set_subject(str_replace(array("{site_name}", "{reply_subject}", "{subject_counter}"), array(format_text(stripslashes($config['site_name']), 2), ((isset($reply_subject)) ? stripslashes($reply_subject) : ""), intval(trim($subject_counter))), $lang['comments_notify_new_reply_message_email_subject_title']));
                $site_email->register_vars(array(
                "user_name" => format_text(stripslashes($user_name), 2),
                "comments_notify_url" => format_url($script_url . "/details.php?image_id=" . $id),
                "comment_user_name" => format_text(stripslashes($user_info['user_name']), 2),
                "site_name" => format_text(stripslashes($config['site_name']), 2),
                "site_email" => stripslashes($config['site_email'])
                ));

                if (isset($additional_user_sql_array) && is_array($additional_user_sql_array) && !empty($additional_user_sql_array)) {
                    foreach ($additional_user_sql_array as $key => $val) {
                        if ($val == $notify_row[$val]) {
                            $site_email->register_vars($val, $notify_row[$val]);
                        }
                    }
                }

                if (isset($additional_image_sql_array) && is_array($additional_image_sql_array) && !empty($additional_image_sql_array)) {
                    foreach ($additional_image_sql_array as $key => $val) {
                        if ($val == $notify_row[$val]) {
                            $site_email->register_vars($val, $notify_row[$val]);
                        }
                    }
                }
                $site_email->set_body("comments_notify_new_reply_message", $config['language_dir_default']);
                $site_email->send_email();              

                unset ($additional_user_sql);
                unset ($additional_user_sql_array);
                unset ($additional_image_sql);
                unset ($additional_image_sql_array);
                unset ($subject_counter);
                
                return $user_id;
            }

            break;          

            case 'comments_notify_statistics' :          

            if (defined('COMMENTS_NOTIFY_STATS_TIME_GLOBAL') && COMMENTS_NOTIFY_STATS_TIME_GLOBAL == true) {          

            $stats_time = time() - 60 * 60 * 24 * (defined('COMMENTS_NOTIFY_STATS_TIME_GLOBAL') && COMMENTS_NOTIFY_STATS_TIME_GLOBAL == true && defined('COMMENTS_NOTIFY_STATS_TIME') && (int)COMMENTS_NOTIFY_STATS_TIME > 0) ?  " AND comment_notify_microtime < " . COMMENTS_NOTIFY_STATS_TIME : "";            

            $sql = "SELECT COUNT(comment_notify_status) AS total_notify
                    FROM " . COMMENT_NOTIFY_TABLE . "
                    WHERE comment_notify_status = 1" . $stats_time;
            $row = $site_db->query_firstrow($sql);
            $check_notify = (isset($row['total_notify'])) ? $row['total_notify'] : 0;            

            $sql = "          

            SELECT " . get_user_table_field("", "user_name") . get_user_table_field(", ", "user_email") . "
            FROM " . USERS_TABLE . "
            WHERE " . get_user_table_field("", "user_id") . " = '1'";
            $get_webmaster_info = $site_db->query_firstrow($sql);            

            if (isset($site_email) && !empty($site_email)) {
                unset ($site_email);
            }
            @include_once(ROOT_PATH . "includes/email.php");
            $site_email = new Email();          

            $site_email->set_to(stripslashes($get_webmaster_info[$user_table_fields['user_email']]));
            $site_email->set_from(stripslashes($config['site_email']));
            $site_email->set_subject(preg_replace("/" . $site_template->start . "site_name" . $site_template->end . "/siU", format_text(stripslashes($config['site_name']), 2), $lang['comments_notify_statistic_report_email_subject']));
            $site_email->register_vars(array(
            "admin_name" => format_text(trim($get_webmaster_info[$user_table_fields['user_name']]), 2),
            "stats_value" => (isset($check_notify) && $check_notify > 0) ? (int)$check_notify : 0,
            "site_name" => format_text(trim($config['site_name']), 2)
            ));
            $site_email->set_body("comments_notify_statistic_message", $config['language_dir_default']);
            $site_email->send_email();          

            return $user_id;
            }          

        } // End switch.              
    }
}
// End of MOD: Comments notify by email.

// Step 4

In includes/page_header.php file,

find:

Code: [Select]
//-----------------------------------------------------
//--- Random Image ------------------------------------
//-----------------------------------------------------
$random_image = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" : get_random_image();
$site_template->register_vars("random_image", $random_image);
unset($random_image);

add after:

Code: [Select]
// MOD: Comments notify by email.
//-----------------------------------------------------
//--- Comments notify by email - statistic ------------
//-----------------------------------------------------
if ($user_info['user_id'] == 1 && defined('COMMENTS_NOTIFY_STATS_TIME_GLOBAL') && COMMENTS_NOTIFY_STATS_TIME_GLOBAL == true && defined('COMMENTS_NOTIFY_STATS_TIME') && (int)COMMENTS_NOTIFY_STATS_TIME > 0 && function_exists('get_comment_notify_by_email')) {
    get_comment_notify_by_email($user_info['user_id'], 'comments_notify_statistics');
}
// End of MOD: Comments notify by email.

// Step 5

In lang/english/main.php file,

add top of ?>:

Code: [Select]
// MOD: Comments notify by email.
//-----------------------------------------------------
//--- Comments notify by email ------------------------
//-----------------------------------------------------
$lang['comments_notify_undefined_table'] = "{table_name} table is NOT defined in includes/constants.php file.";
$lang['comments_notify_email_subject_welcome_message'] = "{site_name} - New feature: Comments notify by email.";
$lang['comments_notify_new_reply_message_email_subject_title'] = "{site_name} - Reply notification: {reply_subject} on post: {subject_counter}.";
$lang['comments_notify_reply_message_email_sent'] = "Thanks {user_name}. Notification reply by email has just been sent to users who wishes to be notified.";
$lang['comments_notify_update_notification_uncheck_message'] = "Thanks {user_name}. Notification has been unchecked for these comments.";
$lang['comments_notify_update_notification_check_message'] = "Thanks {user_name}. Notification has just been checked for these comments.";
$lang['comments_notify_statistic_report_email_subject'] = "{site_name} - Latest statistics.";
// End of MOD: Comments notify by email.

// Step 6

In lang/english/email,

create 3 files: comments_notify_new_reply_message.html, comments_notify_statistic_message.html .

Content per order:

Code: [Select]
Dear {user_name},

{comment_user_name} has just replied to your message.

Comment URL: {comments_notify_url}

Note:

This is an automated message reply system. If you see this message,
it's because you chosed the 'Notify by Email' button option from one
(or many) images you visited in our gallery.

{site_name} does NOT send out email messages on purpose. Emails are
being sent as per users preferences.

Best wishes.
{site_name}

2nd:

Code: [Select]
Dear {admin_name},

You are receiving this email message since you activated
the statistics for the comments notify by email.

Here are the latest stats of all users that checked
the 'Notify by email' button: {stats_value}

Best wishes.
{site_name} .

// Step 7

In templates/your_template/details.html file,

find:

Code: [Select]
<td valign="top" class="head1">{lang_comment}</td>

add after:

Code: [Select]
{if is_admin}<! -- Comment notify by email foreach user -- >{endif is_admin}
   {if user_loggedin}{if comment_num_rows}{if comment_notify_button}<td valign="top" class="head1">
           <form method="post" action="{url_comment_notify_email}">
           <input type="hidden" name="action" value="update_comment_notify_email">            
   <input type="hidden" name="field_id" value="{field_id}">
           <input type="hidden" name="notify_status" value="{comment_notify_value}">
           <input type="hidden" name="image_id" value="{image_id}">
           <input type="image" src="{comment_notify_button}">
           </form>            
           </td>{endif comment_notify_button}{endif comment_num_rows}{endif user_loggedin}
             {if is_admin}<! -- End comment notify by email foreach user -- >{endif is_admin}

// Step 8

In includes/constants.php file,

find:

Code: [Select]
define('COMMENTS_TABLE, $table_prefix.'comments');

add after:

Code: [Select]
define('COMMENTS_NOTIFY_TABLE', $table_prefix.'comments_notify');

Must keep comments_notify at end.

Is all. Thank to Mawenzi for button:

http://www.4homepages.de/forum/index.php?topic=18491.msg99168#msg99168

Upload in templates/your_template/images_english folder. Should all work. ;)

And thank to Mr_Lovalove for test on server.

================================================================
====  New Version  == 08-29-2007 ========================================
===============================================================

Upgrade from before (must use 1st version for 2nd).

// Step 1

In details.php file,

Code: [Select]
// MOD: Notify comments by email.
  "comment_notify_button" => (isset($comment_notify_status) && $comment_notify_status == 1) ? get_gallery_image("notify_check.gif") : get_gallery_image("notify_uncheck.gif"),
  "comment_notify_value" => (isset($comment_notify_status) && $comment_notify_status == 1) ? 1 : 0,
  "url_comment_notify_email" => $site_sess->url(ROOT_PATH . "details.php")
  // End of MOD: Notify comments by email.

add before:

Code: [Select]
"comments_notify_go_back" => (preg_match("/comments_notify.php/", $url)) ? preg_replace("/" . $site_template->start. "go_back" . $site_template->end . "/siU", $site_sess->url(ROOT_PATH . "comments_notify.php"), $lang['comments_notify_go_back']) : "",

Find:

Code: [Select]
redirect("details.php?image_id=" . $image_id);

replace:

Code: [Select]
if (preg_match("/comments_notify.php/", $url)) {
redirect("comments_notify.php");
} else {
redirect("details.php?image_id=" . $image_id);
}

// Step 2 [09/14/2007]

In member.php file,

find:

Code: [Select]
"lang_edit_profile_msg" => $edit_profile_msg,

add after:

Code: [Select]
"lang_comments_notify_ask_question" => $lang['comments_notify_ask_question'],
"lang_comments_notify_ask_question_url_name" => preg_replace("/" . $site_template->start . "click_here" . $site_template->end . "/siU", $site_sess->url(ROOT_PATH . "comments_notify.php"), $lang['comments_notify_ask_question_url_name']),

// Step 3

In lang/english/main.php file,

find:

Code: [Select]
$lang['comments_notify_statistic_report_email_subject'] = "{site_name} - Latest statistics.";

add after:

Code: [Select]
$lang['comments_notify_clickstream_title'] = "Comments notify";
$lang['comments_notify_no_content'] = "No comments notify.";
$lang['comments_notify_title'] = "Comments notify";
$lang['comments_notify_go_back'] = "<a href=\"{go_back}\"><span class=\"smalltext\">[ Go back ]</span></a>";
$lang['comments_notify_image_uploader'] = "Image uploader";
$lang['comments_notify_image_name'] = "Image name";
$lang['comments_notify_comment_status'] = "Notify status";
$lang['comments_notify_date_n_time'] = "Date & time";
$lang['comments_notify_ask_question'] = "Configure my comment notify list:";
$lang['comments_notify_ask_question_url_name'] = "<a href=\"{click_here}\">[ Click here ]</a>";

// Step 4

In templates/your_template/details.html file,

find:

Code: [Select]
<b class="title"><br />{image_name}</b>{if image_is_new} <sup class="new">{lang_new}</sup>{endif

replace:

Code: [Select]
<b class="title">{if comments_notify_go_back}{comments_notify_go_back}{endif comments_notify_go_back}<br /><br />{image_name}</b>{if image_is_new} <sup class="new">{lang_new}</sup>{endif

// Step 5

In ROOT_PATH, create new file: comments_notify.php .

Add:

Code: [Select]
<?php

$main_template 
"comment_notify";

define('ROOT_PATH''./');
include(
ROOT_PATH 'global.php');
require(
ROOT_PATH 'includes/sessions.php');
include(
ROOT_PATH 'includes/page_header.php');

if (
$user_info['user_level'] == GUEST || $user_info['user_level'] == USER_AWAITING) {
    
redirect($url);
}

if (
$action == "") {
    
$action "show_comments_notify";
}

if (
$action == "show_comments_notify") {
    
    
$comments_notify_overwrite_button_status = (defined('COMMENTS_NOTIFY_OVERWRITE_BUTTON_STATUS') && COMMENTS_NOTIFY_OVERWRITE_BUTTON_STATUS == true) ? "cn.comment_notify_status = 1 AND " "";
    
    
$additional_user_sql "";
    
$additional_user_sql_array = array();
    if (isset(
$additional_user_fields) && is_array($additional_user_fields) && !empty($additional_user_fields)) {
        foreach (
$additional_user_fields as $key => $val) {
            
$additional_user_sql .= ", u." $key;
            
$additional_user_sql_array[] = $key;
        }
    }
    
    
$additional_image_sql "";
    
$additional_image_sql_array = array();
    if (isset(
$additional_image_fields) && is_array($additional_image_fields) && !empty($additional_image_fields)) {
        foreach (
$additional_image_fields as $key => $val) {
            
$additional_image_sql .= ", i." $key;
            
$additional_image_sql_array[] = $key;
        }
    }    
    
    
$sql "
    
    SELECT i.user_id, i.cat_id, i.image_id, i.image_name, i.image_active, i.image_allow_comments, cn.field_id, cn.comment_notify_status, cn.comment_notify_date, cn.comment_notify_time" 
get_user_table_field(", u.""user_name") . $additional_user_sql $additional_image_sql "
    FROM (" 
IMAGES_TABLE " i, " COMMENTS_NOTIFY_TABLE " cn)
    LEFT JOIN " 
USERS_TABLE " u ON (" get_user_table_field("u.""user_id") . " = i.user_id)    
    WHERE " 
. ((isset($comments_notify_overwrite_button_status)) ? trim($comments_notify_overwrite_button_status) : "") . " i.image_id = cn.image_id AND cn.user_id = " $user_info['user_id'];    
    
    
$result $site_db->query($sql);
    
$notify_num_rows $site_db->get_numrows($result);
    
    if (isset(
$notify_num_rows) && $notify_num_rows <= 0) {
        
$msg $lang['comments_notify_no_content'];
        
    } elseif (isset(
$notify_num_rows) && $notify_num_rows 0) {
        
        
$comments_notify_template "";
        
$bgcounter 0;        
        
        while (
$image_row $site_db->fetch_array($result)) {
            
$row_count = ($bgcounter++ % == 0) ? 2;
                            
            
$user_id $image_row['user_id'];
            
$image_id $image_row['image_id'];
            
$field_id $image_row['field_id'];
            
$image_name $image_row['image_name'];
            
$image_active $image_row['image_active'];
            
$image_allow_comments $image_row['image_allow_comments'];
            
$user_name $image_row[$user_table_fields['user_name']];
            
$cat_id $image_row['cat_id'];
            
$comment_notify_status $image_row['comment_notify_status'];
            
$comment_notify_date $image_row['comment_notify_date'];
            
$comment_notify_time $image_row['comment_notify_time'];
            
            
$site_template->register_vars(array(
            
"user_id" => (isset($user_id)) ? (int)$user_id 0,
            
"image_id" => (isset($image_id)) ? (int)$image_id 0,
            
"field_id" => (isset($field_id)) ? (int)$field_id 0,
            
"uploader_user_url" => (isset($user_id) && isset($user_name)) ? $site_sess->url(ROOT_PATH "member.php?action=showprofile&" URL_USER_ID "=" $user_id) : "",
            
"url_comment_notify_email" => $site_sess->url(ROOT_PATH "details.php"),
            
"uploader_user_name" => (isset($user_name)) ? format_text(stripslashes($user_name), 2) : "",
            
"image_active" => (isset($image_active) && $image_active == 1) ? true false,
            
"allow_comments" => (isset($image_allow_comments) && $image_allow_comments == 1) ? true false,
            
"image_name" => format_text(stripslashes($image_name), 2),            
            
"comment_notify_button" => (isset($comment_notify_status) && $comment_notify_status == 1) ? get_gallery_image("notify_check.gif") : get_gallery_image("notify_uncheck.gif"),
            
"comment_notify_value" => (isset($comment_notify_status) && $comment_notify_status == 1) ? 0,
            
"comment_notify_date" => (isset($comment_notify_date)) ? trim($comment_notify_date) : "",
            
"comment_notify_time" => (isset($comment_notify_time)) ? trim($comment_notify_time) : "",
            
"row_count" => (isset($row_count) && $row_count 0) ? true false,
            
"image_url" => (isset($image_id)) ? $site_sess->url(ROOT_PATH "details.php?" URL_IMAGE_ID "=" $image_id) : format_text(stripslashes($image_name), 2)
            ));
            if (isset(
$additional_user_sql_array) && is_array($additional_user_sql_array) && !empty($additional_user_sql_array)) {
                foreach (
$additional_user_sql_array as $key => $val) {
                    if (
$val == $image_row[$val]) {
                        
$site_template->register_vars($val$image_row[$val]);
                    }
                }
            }
            if (isset(
$additional_image_sql_array) && is_array($additional_image_sql_array) && !empty($additional_image_sql_array)) {
                foreach (
$additional_image_sql_array as $key => $val) {
                    if (
$val == $image_row[$val]) {
                        
$site_template->register_vars($val$image_row[$val]);
                    }
                }
            }
            
$comments_notify_template .= $site_template->parse_template("comment_notify_content");            
        }        
    }
}

$clickstream "<a href=\"" $site_sess->url(ROOT_PATH "index.php") . "\">" $lang['home'] . "</a>" $config['category_separator'] . $lang['comments_notify_clickstream_title'];

$site_template->register_vars(array(
"clickstream" => trim($clickstream),
"msg" => trim($msg),
"comments_notify_template" => trim($comments_notify_template),
"num_rows" => (isset($notify_num_rows) && $notify_num_rows 0) ? true false,
"lang_comments_notify_title" => $lang['comments_notify_title'],
"lang_comments_notify_image_uploader" => $lang['comments_notify_image_uploader'],
"lang_comments_notify_image_name" => $lang['comments_notify_image_name'],
"lang_comments_notify_comment_status" => $lang['comments_notify_comment_status'],
"lang_comments_notify_date_n_time" => $lang['comments_notify_date_n_time']
));
$site_template->print_template($site_template->parse_template($main_template));

include(
ROOT_PATH 'includes/page_footer.php');
?>


// Step 6

No place post here so attach file and upload in templates/your_template folder.

- User can selek / no selek notify button and see headline from. No more run for notify button foreach detail page.
- Image active and allow comment - auto-detek. Image active off: 2 link off. Allow comment (with image active on) - 1 link off.

Thank to Mr_Lovalove for test on server. ;)

Screenshot - see attach.
« Last Edit: February 18, 2011, 02:43:50 PM by thunderstrike »
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: [MOD] - Comments notify foreach user in details by email
« Reply #1 on: August 26, 2007, 02:06:51 PM »
hi!
thank you very much for this mod!
i'm testing on version 1.7
i think in constant.php i've to insert this:
Code: [Select]
define('COMMENTS_NOTIFY_TABLE', $table_prefix.'comments_notify');

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [MOD] - Comments notify foreach user in details by email
« Reply #2 on: August 26, 2007, 03:18:47 PM »
Correct, topic edit. Thank for posting. 1 bad news ... if test on v1.7 ... 'redirect' function use ... check if in your includes/functions.php file. ;)

No more place on 1st post so I post here - on preview, is say full ... no live  8O (upgrade New Version // 09/15/2007):

Create new file: templates/your_template/comments_notify.html file,

add:

Code: [Select]
{header}
<table width="640" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td>
      <table width="640" border="0" cellspacing="0" cellpadding="0" class="tablehead">
        <tr>
          <td colspan="4"><img src="{template_url}/images/header_top.gif" width="640" height="6" alt="" /></td>
        </tr>
        <tr>
          <td width="6"><img src="{template_url}/images/header_left.gif" width="6" height="60" alt="" /></td>
          <td width="405"><img src="{template_url}/images/header_logo.gif" width="405" height="60" alt="" /></td>
          <td width="225" align="right">
            <form method="post" action="{url_search}">
              <table border="0" cellspacing="0" cellpadding="1">
                <tr>
                  <td>
                    <input type="text" name="search_keywords" size="15" class="searchinput" />
                  </td>
                  <td>
                    <input type="submit" value="{lang_search}" class="button" name="submit" />
                  </td>
                </tr>
                <tr valign="top">
                  <td colspan="2"><a href="{url_search}" class="smalltext">{lang_advanced_search}</a></td>
                </tr>
              </table>
            </form>
          </td>
          <td align="right" width="6"><img src="{template_url}/images/header_right.gif" width="6" height="60" alt="" /></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td class="bordercolor">
      <table width="640" border="0" cellspacing="1" cellpadding="0">
        <tr>
          <td class="tablebgcolor">
            <table width="638" border="0" cellspacing="1" cellpadding="0">
              <tr>
                <td class="navbar" height="23">
                  <table width="636" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td><img src="{template_url}/images/spacer.gif" width="4" height="4" alt="" />{clickstream}</td>
                      <td align="right">
<a href="{url_top_images}"><b>{lang_top_images}</b></a>&nbsp;
<a href="{url_new_images}"><b>{lang_new_images}</b></a>&nbsp;
 </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
            <table width="638" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="150" class="row2" valign="top">
                  <table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20"><img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_registered_user}</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                    <tr>
                      <td align="center" class="row1">{user_box}</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                  </table>
 {if random_image}
                  <table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_random_image}</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                    <tr>
                      <td align="center" class="row1">
   <br />
                        {random_image}
<br />
                        <br />
                      </td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                  </table>
 {endif random_image}
                </td>
                <td width="1" class="bordercolor" valign="top"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                <td width="18" valign="top"><img src="{template_url}/images/spacer.gif" alt="" width="18" height="18" /></td>
                <td width="450" valign="top">
 <br />
                  <span class="title">{site_name}</span>
 <br /><br />
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
          <td>
{if num_rows}
{if comments_notify_template}
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
          <td width="25%" class="head1" align="center" />{lang_comments_notify_image_uploader}</td>
          <td width="25%" class="head1" align="center" />{lang_comments_notify_image_name}</td>
          <td width="25%" class="head1" align="center" />{lang_comments_notify_comment_status}</td>
          <td width="25%" class="head1" align="center" />{lang_comments_notify_date_n_time}</td>
</tr>
</table>
{endif num_rows}
{endif comments_notify_template}
{ifnot num_rows}
{ifnot comments_notify_template}
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
          <td width="100%" class="head1" />&nbsp;{lang_comments_notify_title}</td>          
</tr>
</table>
{endifnot comments_notify_template}
{endifnot num_rows}
{if num_rows}
{if comments_notify_template}
<table width="100%" border="1" cellpadding="1" cellspacing="1" class="tablebottom" />
{comments_notify_template}
</table>
{endif comments_notify_template}
{endif num_rows}

{ifnot num_rows}
{ifnot comments_notify_template}
{if msg}
<table width="100%" border="1" cellpadding="0" cellspacing="0" class="tablebottom" />
<tr>
<td width="100%" class="row1" align="center" /><br />{msg}<br /><br /></td>
</tr>
</table>
{endif msg}
{endifnot comments_notify_template}
{endifnot num_rows}

</td>
</tr>
</table>
                  <p>&nbsp;</p>
                </td>
                <td width="19" valign="top"><img src="{template_url}/images/spacer.gif" alt="" width="19" height="19" /></td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td>
      <table width="640" border="0" cellspacing="0" cellpadding="0" class="tablebottom">
        <tr>
          <td width="6"><img src="{template_url}/images/footer_left.gif" width="6" height="19" alt="" /></td>
          <td width="405">&nbsp;</td>
          <td width="225">&nbsp;</td>
          <td width="6"><img src="{template_url}/images/footer_right.gif" width="6" height="19" alt="" /></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
{footer}

Thank lovalove for note.

[09/05/2007] - // Step 7

In admin/images.php file,

find:

Quote
if ($site_db->query($sql)) {
echo "<b>".$lang['image_delete_success']."</b> ".format_text($image_row['image_name'], 2)." (ID: ".$image_row['image_id'].")<br />\n";

replace:

Code: [Select]
if ($site_db->query($sql)) {
        $sql1 = "SELECT image_id FROM " . COMMENTS_NOTIFY_TABLE . " WHERE image_id = " . $image_row['image_id'];
        $result = $site_db->query($sql1);
        $comments_notify_num_rows = $site_db->get_numrows($result);
        
        if (isset($comments_notify_num_rows) && $comments_notify_num_rows > 0) {
            $sql2 = "DELETE FROM " . COMMENTS_NOTIFY_TABLE . "
                     WHERE image_id = " . $image_row['image_id'];
            $site_db->query($sql2);
        }
      echo "<b>".$lang['image_delete_success']."</b> ".format_text($image_row['image_name'], 2)." (ID: ".$image_row['image_id'].")<br />\n";

Find:

Quote
if ($site_db->query($sql)) {
echo $lang['comments_delete_success']."<br />\n";

replace:

Code: [Select]
if ($site_db->query($sql)) {
        $sql1 = "SELECT image_id FROM " . COMMENTS_NOTIFY_TABLE . " WHERE image_id = " . $image_row['image_id'];
        $result = $site_db->query($sql1);
        $comments_notify_num_rows = $site_db->get_numrows($result);
        
        if (isset($comments_notify_num_rows) && $comments_notify_num_rows > 0) {
        $sql2 = "DELETE FROM " . COMMENTS_NOTIFY_TABLE . "
                 WHERE image_id = " . $image_row['image_id'];
                 $site_db->query($sql2);
        }
      echo $lang['comments_delete_success']."<br />\n";

[09/14/2007] - // Step 8

In templates/your_template/member_editprofile.html file,

find:

Quote
         <tr>
            <td class="row1"><b>{lang_invisible}</b></td>
            <td class="row1">
              <input type="radio" name="user_invisible" value="1"{user_invisible_yes} />
              {lang_yes}&nbsp;&nbsp;&nbsp;
              <input type="radio" name="user_invisible" value="0"{user_invisible_no} />
              {lang_no}
         </td>
          </tr>

add after:

Code: [Select]
 <tr>
            <td class="row2"><b>{lang_comments_notify_ask_question}</b></td>
            <td class="row2">{lang_comments_notify_ask_question_url_name}</td>
          </tr>  

[10/03/2007] - // Step 9

In details.php,

find:

Quote
if ($action == "update_comment_notify_email") {

add after:

Code: [Select]
   if (!defined('COMMENTS_NOTIFY_ACTIVE') || COMMENTS_NOTIFY_ACTIVE == 0) {
        redirect($url);
    }

Find:

Quote
$clickstream .= $image_name."</span>";

add after:

Code: [Select]
// Comments notify by email - validation.
if (isset($comment_notify_status) && $comment_notify_status == 1 && defined('COMMENTS_NOTIFY_ACTIVE') && COMMENTS_NOTIFY_ACTIVE == 1) {
    $comments_flag = get_gallery_image("notify_by_email_check.gif");
} elseif (isset($comment_notify_status) && $comment_notify_status == 1 && defined('COMMENTS_NOTIFY_ACTIVE') && COMMENTS_NOTIFY_ACTIVE == 0) {
    $comments_flag = false;
} elseif (isset($comment_notify_status) && $comment_notify_status == 0 && defined('COMMENTS_NOTIFY_ACTIVE') && COMMENTS_NOTIFY_ACTIVE == 1) {
    $comments_flag = get_gallery_image("notify_by_email_uncheck.gif");
} elseif (isset($comment_notify_status) && $comment_notify_status == 0 && defined('COMMENTS_NOTIFY_ACTIVE') && COMMENTS_NOTIFY_ACTIVE == 0) {
    $comments_flag = false;
}

Find:

Quote
"comment_notify_button" => (isset($comment_notify_status) && $comment_notify_status == 1) ? get_gallery_image("notify_check.gif") : get_gallery_image("notify_uncheck.gif"),

replace:

Code: [Select]
"allow_use_comment_notify" => (defined('COMMENTS_NOTIFY_ACTIVE') && COMMENTS_NOTIFY_ACTIVE == 1 ? true : false) . (isset($comment_notify_status) && (int)$comment_notify_status == 1 ? (int)$comment_notify_status = 0 : false),
"comment_notify_button" => (isset($comments_flag) && (bool)$comments_flag == true) ? $comments_flag : "",

In comments_notify.php file,

find:

Quote
if (isset($notify_num_rows) && $notify_num_rows <= 0) {

replace:

Code: [Select]
if (isset($notify_num_rows) && $notify_num_rows <= 0 || defined('COMMENTS_NOTIFY_ACTIVE') && COMMENTS_NOTIFY_ACTIVE == 0) {

Find:

Quote
} elseif (isset($notify_num_rows) && $notify_num_rows > 0) {

replace:

Code: [Select]
} elseif (isset($notify_num_rows) && $notify_num_rows > 0 && defined('COMMENTS_NOTIFY_ACTIVE') && COMMENTS_NOTIFY_ACTIVE == 1) {

In includes/constants.php file,

add top of ?>:

Code: [Select]
define('COMMENTS_NOTIFY_ACTIVE', 1); // Set to active.

Set 0 if no want active.

In templates/your_template/details.html file,

find:

Quote
{if user_loggedin}{if comment_num_rows}{if comment_notify_button}<td valign="top" class="head1">

replace:

Code: [Select]
{if allow_use_comment_notify}{if user_loggedin}{if comment_num_rows}{if comment_notify_button}<td valign="top" class="head1">

Find:

Quote
</td>{endif comment_notify_button}{endif comment_num_rows}{endif user_loggedin}

replace:

Code: [Select]
</td>{endif comment_notify_button}{endif comment_num_rows}{endif user_loggedin}{endif allow_use_comment_notify}

All done for step 9.
« Last Edit: February 19, 2011, 04:34:14 PM by thunderstrike »
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: [MOD] - Comments notify foreach user in details by email
« Reply #3 on: August 26, 2007, 03:35:04 PM »
hi,
you are right.. it's not working on 1.7
if i insert in detail.php this:
Quote
// MOD: Notify comments by email.
$sql = "SELECT cn.comment_notify_status
        FROM " . COMMENTS_NOTIFY_TABLE . " cn
        LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = cn.user_id)
        WHERE cn.image_id = " . $image_id . " AND " . get_user_table_field("cn.", "user_id") . " = " . $user_info['user_id'] . " AND " . get_user_table_field("u.", "user_level") . " >= '" . USER . "'";       
// End of MOD: Notify comments by email.


and klick on any image it'S open only the index site...

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [MOD] - Comments notify foreach user in details by email
« Reply #4 on: August 26, 2007, 03:39:50 PM »
Try with fresh folder and new DB name with 4images v1.74 for result. First post, I say is test on v1.74.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Mr_LovaLove

  • Full Member
  • ***
  • Posts: 233
  • Unkown
    • View Profile
Re: [MOD] - Comments notify foreach user in details by email
« Reply #5 on: August 26, 2007, 06:33:54 PM »
The best thing is that it works with 1.7.4 :P

but not added to my site ( not at home )
i have some qs ?

is this mod send emails to the users who upload the pix ( the owner of the pic )

or

it sends pic to the users who are in the friendslists

and do we have to user PM < v@no > MOD

or

if the user comment on my pic a notification will be sent to my registered email in the site ??

sorry for this questions
English Please :@

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [MOD] - Comments notify foreach user in details by email
« Reply #6 on: August 26, 2007, 08:16:18 PM »
Quote
if the user comment on my pic a notification will be sent to my registered email in the site ??

Close. ;)

It sends email to all replier of comments in image up loader user (details page). All get email axept for current post user and image owner foreach reply (Mawenzi button is check - if no - no send email). ;)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Mr_LovaLove

  • Full Member
  • ***
  • Posts: 233
  • Unkown
    • View Profile
Re: [MOD] - Comments notify foreach user in details by email
« Reply #7 on: August 26, 2007, 08:47:43 PM »
very nice thunder
 
and thanks 4 the fast replay

i have a small problem !! :S

whenever i click on the pix to see it details ! :S it redirect me to the home.html :S

i can see the details.html :S

< i dont know why i play with the code from my work lol >

coz i was lookin for this kind of idea ;)

hope u have the solution!!

coz already the welcome email was  sent auto for users  :(
English Please :@

Offline Mr_LovaLove

  • Full Member
  • ***
  • Posts: 233
  • Unkown
    • View Profile
Re: [MOD] - Comments notify foreach user in details by email
« Reply #8 on: August 26, 2007, 09:21:39 PM »
i think something is missing in my details.php !??

btw, this is clean mod ! is not related to any other mods !! >> right :S

details.php is included in the attachement !! :S

i have to let someone from home to upload the old details.php !

u dont have to see my details.php if u have the answer :)
English Please :@

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [MOD] - Comments notify foreach user in details by email
« Reply #9 on: August 26, 2007, 10:47:26 PM »
Quote
i can see the details.html :S

You see details.html ... is ok ... must see it ... when click on notify by email button ... is redirect to last url ...
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline ccsakuweb

  • Sr. Member
  • ****
  • Posts: 498
  • Patri
    • View Profile
    • My Art
Re: [MOD] - Comments notify foreach user in details by email
« Reply #10 on: August 27, 2007, 12:03:34 AM »
wow thank you very much. it is a great mod. i thougth to make it but i didnt have time enough
:arrow: 4images Paid Mods: Links, Blog, Albums, Subdomains for users, Diferent templates for user profile, Related picture in details, Last pictures in details.
And the mod that you request me.   Demo: http://www.myart.es

A website dedicated to artist people who loves drawing, design, writing and more

Offline Mr_LovaLove

  • Full Member
  • ***
  • Posts: 233
  • Unkown
    • View Profile
Re: [MOD] - Comments notify foreach user in details by email
« Reply #11 on: August 27, 2007, 11:48:54 AM »
nO thunder  !

i meant i can't ( cannot ) see the details.html

when i  go to my category lets assume i went to ( cars category )

then i can see all pix in the cars category when i click on the image to see the details

the page redirect me to home.html ! and that mean i cannot see the details

so admin or users cannot see any details of any image in the site !

i tried to trace the error ! i went to upload to upload some images it works with ur MOD

that why i upload the details.php

tell you the truth, i dont have PM in my site ! from the code i can see its ok to not have that mod installed in my site !
can you tell me where is my mistake plz ?

as i said there is no errors at all !

waitin ur replay :)
English Please :@

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: [MOD] - Comments notify foreach user in details by email
« Reply #12 on: August 27, 2007, 12:40:46 PM »
hi,
this is the same error on my site!
i hope that thunderstrike can help us..

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [MOD] - Comments notify foreach user in details by email
« Reply #13 on: August 27, 2007, 04:14:52 PM »
Ok, in details.php file,

find:

Quote
// MOD: Notify comments by email.
$sql = "SELECT cn.comment_notify_status
           FROM " . COMMENTS_NOTIFY_TABLE . " cn
           LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = cn.user_id)
           WHERE cn.image_id = " . $image_id . " AND " . get_user_table_field("cn.", "user_id") . " = " . $user_info['user_id'] . " AND " . get_user_table_field("u.", "user_level") . " >= '" . USER . "'";       
// End of MOD: Notify comments by email.

replace:

Quote
// MOD: Notify comments by email.
$sql1 = "SELECT cn.comment_notify_status
             FROM ("  . IMAGES_TABLE . " i, " . CATEGORIES_TABLE . " c, " . COMMENTS_NOTIFY_TABLE . " cn)
             LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = cn.user_id)
             WHERE cn.image_id = " . $image_id . " AND c.cat_id = i.cat_id AND " . get_user_table_field("cn.", "user_id") . " = " . $user_info['user_id'] . " AND " . get_user_table_field("u.", "user_level") . " >= '" . USER . "'";       
// End of MOD: Notify comments by email.

Find:

Quote
$image_row = $site_db->query_firstrow($sql);

add after:

Quote
$image_row = $site_db->query_firstrow($sql1);
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [MOD] - Comments notify foreach user in details by email
« Reply #14 on: August 27, 2007, 04:46:38 PM »
Quote
i thougth to make it but i didnt have time enough

Yeah, yeah - does it work for you ?
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?