ALTER TABLE `gal_pictures` ADD `notify` ENUM( 'Yes', 'No' ) DEFAULT 'Yes' NOT NULL ;
ALTER TABLE `gal_pictures` ADD `sent` INT( 11 ) NOT NULL ;
'forb_ext' => 'Forbidden file extension.',//cpg1.4
'notify_comm' => 'Notify me of comments.',//cpg1.4
$del_comments = isset($_POST['del_comments']) || $delete;
$notify = isset($_POST['notify']);
if ($reset_votes) $update .= ", pic_rating = '0', votes = '0'";
if($notify) {
$update .= ", notify = 'Yes'";
}else{
$update .= ", notify = 'No'";
}
// If this is the users gallery icon then check it
$isgalleryicon_selected = ($CURRENT_PIC['galleryicon']) ? 'checked="checked" ': '';
$isgalleryicon_disabled = ($CURRENT_PIC['category'] < FIRST_USER_CAT)? 'disabled="disabled" ':'';
// If the user is being notfied already then check it.
$isnotified = ($CURRENT_PIC['notify']) == "Yes" ? 'checked="checked" ': '';
<tr>
<td width="20%" align="center"><input type="checkbox" name="galleryicon" {$isgalleryicon_selected}{$isgalleryicon_disabled}value="{$CURRENT_PIC['pid']}" class="checkbox" />{$lang_editpics_php['gallery_icon']}</td>
<td width="20%" align="center"><input type="checkbox" name="read_exif" value="1" class="checkbox" />{$lang_editpics_php['read_exif']}</td>
<td width="20%" align="center"><input type="checkbox" name="reset_vcount" value="1" class="checkbox" />{$lang_editpics_php['reset_view_count']}</td>
<td width="20%" align="center"><input type="checkbox" name="reset_votes" value="1" class="checkbox" />{$lang_editpics_php['reset_votes']}</td>
<td width="20%" align="center"><input type="checkbox" name="del_comments" value="1" class="checkbox" />{$lang_editpics_php['del_comm']}</td>
</tr>
<tr>
<td width="100%" align="center" colspan="5"><input type="checkbox" name="notify" value="1" {$isnotified} class="checkbox" />{$lang_editpics_php['notify_comm']}</td>
</tr>
if (!USER_ID) { // Anonymous users, we need to use META refresh to save the cookie
//Start New User Notification Code
$result = cpg_db_query("SELECT owner_id, notify, sent FROM {$CONFIG['TABLE_PICTURES']} WHERE pid=".$pid);
list($uid, $notify, $sent) = mysql_fetch_row($result);
// We can't send an email if this pic was uploaded by a guest
//User must request notification.
if ($uid && $notify == "Yes"){
// This can get the right info if the bridge is enabled or not.
$picture_owner_data = $cpg_udb->get_user_infos($uid);
//make sure we don't email ourself and that we arent being flooded
if(USER_ID != $uid && !$sent){
// check the user has specified an email address
if ($picture_owner_data['user_email']){
$subject = "TMV: New Gallery Comment by ".USER_NAME;
$mail_body = "Hi ".$picture_owner_data['user_name']."!!<br />\n".USER_NAME." just wrote a comment on one of your photos, click the link below to read and reply to it.<br /><br />\n";
$mail_body .= $CONFIG['site_url'] . "displayimage.php?pos=-".$pid."<br /><br />\n";
$mail_body .= "More comments may be posted, but you won't receive any more notifications until you read them.<br />\n";
$mail_body .= "Thanks,<br />{$CONFIG['gallery_name']} Team.";
cpg_mail($picture_owner_data['user_email'], $subject, $mail_body);
}
//Mark that we've sent a notification so the pic owner doesnt get flooded.
if(!$sent){
$result = cpg_db_query("UPDATE {$CONFIG['TABLE_PICTURES']} SET sent = 1 WHERE pid=".$pid);
}
}
}
// End User Notification Code.
<a href="javascript:;" onclick="return MM_openBrWindow('picEditor.php?id={$CURRENT_PIC_DATA['pid']}','Crop_Picture','scrollbars=yes,toolbar=no,status=yes,resizable=yes')" class="admin_menu" >{$lang_display_image_php['crop_pic']}</a> <a href="editOnePic.php?id={$CURRENT_PIC_DATA['pid']}&what=picture" class="admin_menu">{$lang_display_image_php['edit_pic']}</a> <a href="delete.php?id={$CURRENT_PIC_DATA['pid']}&what=picture" class="admin_menu" onclick="return confirm('{$lang_display_image_php['confirm_del']}'); return false; ">{$lang_display_image_php['del_pic']}</a>
EOT;
//Email Notification Flood Protection.
if($CURRENT_PIC_DATA['sent']==1){
$result = cpg_db_query("UPDATE {$CONFIG['TABLE_PICTURES']} SET sent = 0 WHERE pid = '".$CURRENT_PIC_DATA['pid']."'");
}
//End Email Notification Flood Protection.
Hmm, you must be using SMF integration. That should be cpg_db_query instead of db_query.
coolio... this would be a useful mod.
db_query() was renamed cpg_db_query() in 1.4 because it conflicted with other apps (particularly SMF) that have a function of the same name. That's the only reason the hack works for you - it is in fact using SMF's database functions and not Coppermine's.
I'll post a tidied up version, there are several problems with this hack. :)
if (!USER_ID) { // Anonymous users, we need to use META refresh to save the cookie
//Start New User Notification Code
$result = cpg_db_query("SELECT owner_id FROM {$CONFIG['TABLE_PICTURES']} WHERE pid=".$pid);
list($uid) = mysql_fetch_row($result);
// We can't send an email if this pic was uploaded by a guest
if ($uid){
// This can get the right info if the bridge is enabled or not.
$picture_owner_data = $cpg_udb->get_user_infos($uid);
//make sure we don't email ourself.
if(USER_ID != $uid){
// check the user has specified an email address
if ($picture_owner_data['user_email']){
$subject = "New Gallery Comment by ".USER_NAME." at {$CONFIG['gallery_name']} ";
$mail_body = "Hi ".$picture_owner_data['user_name']."!\n\n".USER_NAME." just wrote a comment on one of your photos, click the link below to read and reply to it.\n";
$mail_body .= $CONFIG['site_url'] . "displayimage.php?pos=-".$pid;
cpg_mail($picture_owner_data['user_email'], $subject, $mail_body);
}
}
}
// End User Notification Code.
I'm not sure if it's in the code, but does the picture owner have an option not to receive notification, as they can do for forum post notifications?
No, but it could be added.
// If this is the users gallery icon then check it
$isgalleryicon_selected = ($CURRENT_PIC['galleryicon']) ? 'checked="checked" ': '';
$isgalleryicon_disabled = ($CURRENT_PIC['category'] < FIRST_USER_CAT)? 'disabled="disabled" ':'';
<tr>
<td width="20%" align="center"><input type="checkbox" name="galleryicon" {$isgalleryicon_selected}{$isgalleryicon_disabled}value="{$CURRENT_PIC['pid']}" class="checkbox" />{$lang_editpics_php['gallery_icon']}</td>
<td width="20%" align="center"><input type="checkbox" name="read_exif" value="1" class="checkbox" />{$lang_editpics_php['read_exif']}</td>
<td width="20%" align="center"><input type="checkbox" name="reset_vcount" value="1" class="checkbox" />{$lang_editpics_php['reset_view_count']}</td>
<td width="20%" align="center"><input type="checkbox" name="reset_votes" value="1" class="checkbox" />{$lang_editpics_php['reset_votes']}</td>
<td width="20%" align="center"><input type="checkbox" name="del_comments" value="1" class="checkbox" />{$lang_editpics_php['del_comm']}</td>
</tr>
//Start New User Notification Code
$result = cpg_db_query("SELECT owner_id, filename, filepath, notify, sent, pwidth, pheight FROM {$CONFIG['TABLE_PICTURES']} WHERE pid=".$pid);
list($uid, $filename, $filepath, $notify, $sent, $pwidth, $pheight) = mysql_fetch_row($result);
// We can't send an email if this pic was uploaded by a guest
//User must request notification.
if ($uid && $notify == "Yes"){
// This can get the right info if the bridge is enabled or not.
$picture_owner_data = $cpg_udb->get_user_infos($uid);
//make sure we don't email ourself and that we arent being flooded
if(USER_ID != $uid && !$sent){
// check the user has specified an email address
if ($CONFIG['make_intermediate'] && max($pwidth, $pheight) > $CONFIG['picture_width']) {
$picture_url = normal_;
} else {
$picture_url = '';
}
// send an email to the owner of the picture
if ($picture_owner_data['user_email']){
$subject = "New website Comment by ".USER_NAME;
$mail_body = "Hi <b>".$picture_owner_data['user_name']."!</b>\n\n".USER_NAME." just wrote a comment on one of your photos:<br /><b>".$_POST['msg_body']."</b><br /><br /><a href='$CONFIG[site_url]displayimage.php?pos=-$pid'><img src='$CONFIG[site_url]albums/".$filepath."".$picture_url."$filename'></img></a><br />Click the image above to reply to the comment or click <a href='$CONFIG[site_url]displayimage.php?pos=-$pid'><b>HERE</b></a>.<br />\n";
$mail_body .= "More comments may be posted, but you won't receive any more notifications until you read them.<br />\n";
cpg_mail($picture_owner_data['user_email'], $subject, make_clickable($mail_body), 'text/plain', "website", 'name@website.com');
}
//Mark that we've sent a notification so the pic owner doesnt get flooded.
if(!$sent){
$result = cpg_db_query("UPDATE {$CONFIG['TABLE_PICTURES']} SET sent = 1 WHERE pid=".$pid);
}
}
}
// End User Notification Code.
'del_all_comm' => 'Delete ALL comments', //cpg1.4
'notify_all_comm' => 'Notify me on ALL comments',
$del_comments = isset($_POST['del_comments'.$pid]) || $delete;
$notify = isset($_POST['notify'.$pid]);
if ($reset_votes) $update .= ", pic_rating = '0', votes = '0'";
if($notify) {
$update .= ", notify = 'Yes'";
}else{
$update .= ", notify = 'No'";
}
// If this is the users gallery icon then check it
$isgalleryicon_selected = ($CURRENT_PIC['galleryicon']) ? 'checked="checked" ': '';
$isgalleryicon_disabled = ($CURRENT_PIC['category'] < FIRST_USER_CAT)? 'disabled="disabled" ':'';
// If the user is being notfied already then check it.
$isnotified = ($CURRENT_PIC['notify']) == "Yes" ? 'checked="checked" ': '';
<tr>
<td width="20%" align="center"><input type="checkbox" name="galleryicon" {$isgalleryicon_selected}{$isgalleryicon_disabled}value="{$CURRENT_PIC['pid']}" class="checkbox" />{$lang_editpics_php['gallery_icon']}</td>
<td width="20%" align="center"><input type="checkbox" name="read_exif" value="1" class="checkbox" />{$lang_editpics_php['read_exif']}</td>
<td width="20%" align="center"><input type="checkbox" name="reset_vcount" value="1" class="checkbox" />{$lang_editpics_php['reset_view_count']}</td>
<td width="20%" align="center"><input type="checkbox" name="reset_votes" value="1" class="checkbox" />{$lang_editpics_php['reset_votes']}</td>
<td width="20%" align="center"><input type="checkbox" name="del_comments" value="1" class="checkbox" />{$lang_editpics_php['del_comm']}</td>
</tr>
<tr>
<td width="100%" align="center" colspan="5"><input type="checkbox" name="notify{$CURRENT_PIC['pid']}" id="notify{$CURRENT_PIC['pid']}" value="1" {$isnotified} class="checkbox" /><label for="notify{$CURRENT_PIC['pid']}" class="clickable_option">{$lang_editpics_php['notify_comm']}</label></td>
</tr>
<td width="20%" align="right">
<b>{$lang_editpics_php['select_unselect']}:</b>
</td>
<td width="20%" align="center">
<span class="admin_menu">
<input type="checkbox" name="deleteAll" onclick="selectAll(this,'delete');" class="checkbox" id="deleteAll" />
<label for="deleteAll" class="clickable_option">{$lang_editpics_php['del_all']}</label>
</span>
</td>
<td width="20%" align="center">
<span class="admin_menu">
<input type="checkbox" name="reset_vcountAll" onclick="selectAll(this,'reset_vcount');" class="checkbox" id="reset_vcountAll" />
<label for="reset_vcountAll" class="clickable_option">{$lang_editpics_php['reset_all_view_count']}</label>
</span>
</td>
<td width="20%" align="center">
<span class="admin_menu">
<input type="checkbox" name="reset_votesAll" onclick="selectAll(this,'reset_votes');" class="checkbox" id="reset_votesAll" />
<label for="reset_votesAll" class="clickable_option">{$lang_editpics_php['reset_all_votes']}</label>
</span>
</td>
<td width="20%" align="center">
<span class="admin_menu">
<input type="checkbox" name="del_commentsAll" onclick="selectAll(this,'del_comments');" class="checkbox"reset_votesAll" id="del_commentsAll" />
<label for="del_commentsAll" class="clickable_option">{$lang_editpics_php['del_all_comm']}</label>
</span>
</td>
<td align="right">
<b>{$lang_editpics_php['select_unselect']}:</b>
</td>
<td align="center">
<span class="admin_menu">
<input type="checkbox" name="deleteAll" onclick="selectAll(this,'delete');" class="checkbox" id="deleteAll" />
<label for="deleteAll" class="clickable_option">{$lang_editpics_php['del_all']}</label>
</span>
</td>
<td align="center">
<span class="admin_menu">
<input type="checkbox" name="reset_vcountAll" onclick="selectAll(this,'reset_vcount');" class="checkbox" id="reset_vcountAll" />
<label for="reset_vcountAll" class="clickable_option">{$lang_editpics_php['reset_all_view_count']}</label>
</span>
</td>
<td align="center">
<span class="admin_menu">
<input type="checkbox" name="reset_votesAll" onclick="selectAll(this,'reset_votes');" class="checkbox" id="reset_votesAll" />
<label for="reset_votesAll" class="clickable_option">{$lang_editpics_php['reset_all_votes']}</label>
</span>
</td>
<td align="center">
<span class="admin_menu">
<input type="checkbox" name="del_commentsAll" onclick="selectAll(this,'del_comments');" class="checkbox"reset_votesAll" id="del_commentsAll" />
<label for="del_commentsAll" class="clickable_option">{$lang_editpics_php['del_all_comm']}</label>
</span>
</td>
<td align="center">
<span class="admin_menu">
<input type="checkbox" name="notify" {$isnotified} onclick="selectAll(this,'notify');" class="checkbox"reset_votesAll" id="notify" />
<label for="notify" class="clickable_option">{$lang_editpics_php['notify_all_comm']}</label>
</span>
</td>
Tried this mod and it works excellent on 1.4.8 bridged with phpbb2. ;D
One question though: My phpbb2 setup sends out message notifications using html email.... It would be terrific if I could use the same html template for the emails send after commenting on pictures....
Anyone who knows how to send html email instead of plain text?
Thanks!
Willem.
cpg_mail($picture_owner_data['user_email'], $subject, $mail_body);
cpg_mail($picture_owner_data['user_email'], $subject, make_clickable($mail_body), 'text/plain);
hi
I want to try this on a punbb integration
I am guessing it will work as people have it runing with phpbb...my question is, as the profile page is not accessable because it is now punbb's profile page, will users till be able to opt out of email notifications?
all the best
Nick
if($notify) {
$update .= ", notify = 'Yes'";
}else{
$update .= ", notify = 'No'";
}
if ($reset_votes) {$update .= ", pic_rating = '0', votes = '0'";resetDetailVotes($pid);}
if ($reset_votes) {$update .= ", pic_rating = '0', votes = '0'";resetDetailVotes($pid);
}
and without it, it is not working the update.If you are refering to the fact that the link is not clickable in the notification email you can chage this in db_input.php
Find thisCode: [Select]cpg_mail($picture_owner_data['user_email'], $subject, $mail_body);
Replace withCode: [Select]cpg_mail($picture_owner_data['user_email'], $subject, make_clickable($mail_body), 'text/plain);
'
Replace withcpg_mail($picture_owner_data['user_email'], $subject, make_clickable($mail_body), 'text/plain');
One of my members has asked if there was any way of being informed when a new comment is added to any image and not just their own.
I am running Coppermine 1.4.14 bridged to phpbb3.That setup goes unsupported (as in "no support at all"). You're not allowed to ask questions on a mods thread if you run this setup. You know our thoughts on this: upgrade to the most recent stable release, and figure out stuff that may be related to the unsupported phpbb3 bridge on your own.
Have I upset you?Yes. You encourage others to downgrade with your incorrect assumptions. That's not what I would expect from someone with your skill level. It's damaging the reputation of the app. You drew the false conclusions. Please keep the downgrade discussion you started to the threads that you already posted in about your downgrade suggestions.