4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: Acidgod on October 12, 2005, 01:22:56 PM

Title: [MOD] PM to owner of image when Comment ist posted
Post by: Acidgod on October 12, 2005, 01:22:56 PM
This is a littel Tutorial to use the PMv2 Mod (http://www.4homepages.de/forum/index.php?topic=6692.0) to inform Image owner over new Comments.

1. Open details.php and find
Code: [Select]
      $site_db->query($sql);
     $commentid = $site_db->get_insert_id();
     update_comment_count($id, $user_info['user_id']);

2. Add below
Code: [Select]
$sql = "SELECT 'user_id', 'image_thumb_file', 'cat_id' FROM ".IMAGES_TABLE." WHERE image_id = $id";
$user_id = $site_db->query($sql);
$user_id = $image_row['user_id'];
if ($image_row['user_id'] != $user_info['user_id']) {
$image_url = $script_url."/details.php?".URL_IMAGE_ID."=".$id."";
$image_name_url = "[url=".$image_url."]".$image_name."[/url]";

if (!empty($image_row['image_thumb_file'])) {
$cat_id = $image_row['cat_id'];
$image_thumb_file = $image_row['image_thumb_file'];
$thumb = $site_sess->url(ROOT_PATH."data/thumbnails/".$cat_id."/".$image_thumb_file);
$thumb = "[url=".$image_url."][img]".$thumb."[/img][/url]";
} else {
$thumb = "";
}

$pm_from = 0; //Hier bitte die user_id vom Absender angeben
$pm_type = 5;
$pm_bbcode = 1;
$pm_smiles = 1;
$pm_sig = "-- \n Mit freundlichen Grüßen, \n euer Picsforfree.de Team";

$pm_message = "Das folgende Bild hat ein Kommentar von ".$user_name." erhalten: \n\n [B]Bild:[/B] ".$image_name_url."\n".$thumb." \n\n [B]Überschrift:[/B] ".$comment_headline." \n [B]Kommentar:[/B] ".$comment_text."\n\n".$pm_sig;
$pm_subject = "\"".$image_name."\" hat ein Kommentar von ".$user_name." erhalten";

$sql = "INSERT INTO ".PM_TABLE."
(pm_date, pm_to, pm_from, pm_subject, pm_type, pm_text, pm_bbcode, pm_html, pm_ip, pm_smiles)
VALUES
('".time()."', $user_id, $pm_from, '".$pm_subject."', $pm_type, '".$pm_message."', $pm_bbcode, 0, '".$session_info['session_ip']."', $pm_smiles)";
$result = $site_db->query($sql);
}

Thats all... (o:
Title: Re: PM to owner of image when Comment ist posted
Post by: mawenzi on October 12, 2005, 03:56:52 PM
hi Acidgod,

bin begeistert von der Idee und der Umsetzung ... dein MOD arbeitet tadellos ...  :D

Danke mawenzi
Title: Re: PM to owner of image when Comment ist posted
Post by: mawenzi on October 12, 2005, 04:31:11 PM
eine kleine Ergänzung :

wenn man in der PM gleich ein klickbares Vorschaubild (Thumbnail) mit anzeigen lassen möchte,
dann wäre nur [thumb=".$id."] hinzuzufügen,
bzw. wäre die folgende Codezeile :
Code: [Select]
$pm_message = "Das folgende Bild hat ein Kommentar von ".$user_name." erhalten: \n\n [B]Bild:[/B] [url=".$images_url."]".$image_name."[/url] \n [B]Überschrift:[/B] ".$comment_headline." \n [B]Kommentar:[/B] ".$comment_text."\n\n -- \n Mit freundlichen Grüßen, \n ";

gegen diese Codezeile auszutauschen :
Code: [Select]
$pm_message = "Das folgende Bild hat ein Kommentar von ".$user_name." erhalten: \n\n [B]Bild:[/B] [url=".$image_url."]".$image_name."[/url] \n \n [thumb=".$id."] \n\n  [B]Überschrift:[/B] ".$comment_headline." \n [B]Kommentar:[/B] ".$comment_text."\n\n -- \n Mit freundlichen Grüßen, \n ";

Nochmals ... Klasse MOD ... und danke Acidgod !

PS. der kleine Schreibfehler $images_url ... richtig : $image_url wird mit der ausgetauschten Codezeile gleich berichtigt.

mawenzi
Title: Re: PM to owner of image when Comment ist posted
Post by: Acidgod on October 12, 2005, 05:58:02 PM
Also das mit dem Thumb klappt bei mir so nicht... (o:

Aber ich habe noch eine If Abfrage hinzugefügt und jetzt bekommt man keine PN wenn man seine eigenen Bilder kommentiert.
Title: Re: PM to owner of image when Comment ist posted
Post by: mawenzi on October 12, 2005, 06:24:48 PM
Die Funktion [thumb=xxxx] bringt der erweiterte BB-Tag-Editor mit !
Mehr dazu kannst du hier (http://www.4homepages.de/forum/index.php?topic=6692.msg38310#msg38310) und in den folgenden Beiträgen nachlesen.

mawenzi
Title: Re: PM to owner of image when Comment ist posted
Post by: Acidgod on October 12, 2005, 07:17:49 PM
So habe die Thumbnails jetzt auch mit eingebaut ohne das man den BBCode Mod miteinbauen muss... (o:
Title: Re: PM to owner of image when Comment ist posted
Post by: Flo2005 on October 23, 2005, 11:32:49 PM
I only get a pm but no email when a comment was given to a file - my email notify for pm´s is on!


by Flo2005
Title: Re: PM to owner of image when Comment ist posted
Post by: Acidgod on October 24, 2005, 09:56:34 AM
Thats right...

I think its enought wenn the User comes back an see where is a new comment.

You also can combine this with the "eMail to owner of images..." Mod
Title: Re: PM to owner of image when Comment ist posted
Post by: Flo2005 on October 24, 2005, 10:01:33 AM
Okay - that´s a good idea - thanks a lot!
Title: Re: PM to owner of image when Comment ist posted
Post by: Flo2005 on October 24, 2005, 10:08:40 AM
One thing:

Is it possible that the user can turn it on/off in the control panel when a comment is posted :?:

cya by Flo2005
Title: Re: PM to owner of image when Comment ist posted
Post by: Acidgod on October 24, 2005, 10:17:42 AM
Not jet...
But you can use the  user_allowemails Field for this...
Title: Re: PM to owner of image when Comment ist posted
Post by: dosensteck on October 24, 2005, 05:57:32 PM
Also das mit dem Thumb klappt bei mir so nicht... (o:

Aber ich habe noch eine If Abfrage hinzugefügt und jetzt bekommt man keine PN wenn man seine eigenen Bilder kommentiert.

könntest du diese vielleicht noch posten?
Title: Re: PM to owner of image when Comment ist posted
Post by: Acidgod on October 24, 2005, 06:19:40 PM
Habe es oben gleich mit eingebaut... (o:
Title: Re: PM to owner of image when Comment ist posted
Post by: dosensteck on October 25, 2005, 02:28:04 PM
wunderbar!

hab gestern den pm mod installiert und dein script.


benutze die pm funktion von phpbb aber - die von vano (mit deinen csript) ist jetzt das nachrichtensystem - user werden nur über neu kommentierte bilder informiert :)
Title: Re: PM to owner of image when Comment ist posted
Post by: Flo2005 on October 26, 2005, 06:56:35 PM
Flo:
Quote
One thing:

Is it possible that the user can turn it on/off in the control panel when a comment is posted

cya by Flo2005

--------------------------------------------------------------------------------
Acidgod:
Quote
Not jet...
But you can use the  user_allowemails Field for this...

Also man kann diese Funktion nicht mit "Emails von Administratoren erhalten" abschalten, was muss an der Emailfunktion geändert werden?

Users cannot turn off the pm function with "user_allowemails" when comment is post, what must I change to realize this?

Flo2005
Title: Re: PM to owner of image when Comment ist posted
Post by: Acidgod on October 26, 2005, 07:19:20 PM
Also am besten wäre es bestimmt ein Feld zu dem Kontrollmenü hinzuzufügen...
Anleitungen gibt es dafür ja mehr als genug.
Traust Du es Dir zu das zu machen?

Wenn ja dann baue ich dir die Abfrage hier mit ein... (o:
Title: Re: PM to owner of image when Comment ist posted
Post by: Flo2005 on October 26, 2005, 07:24:11 PM
Das Feld könnte ich in die member_editprofile.html einbauen, aber ich muss da ja auch bestimmt php Dateien bearbeiten und ggf. eine Tabelle i.d. Datenbank anlegen, oder?
Hast Du zufällig ein Link zu einer solchen Anleitung parat?

Danke im Voraus by Flo2005
Title: Re: PM to owner of image when Comment ist posted
Post by: Acidgod on October 26, 2005, 08:22:37 PM
Weisst Du wie man ein Feld in der DB anlegt?

Wenn ja dann sollte das helfen...
http://www.4homepages.de/forum/index.php?topic=747.msg3277#msg3277

Aber nutze bitte ein Radio Button als auswahl... (o:

Und die Ausgabe in der Detail.html ist natürlich überflüssig...
Title: Re: PM to owner of image when Comment ist posted
Post by: Flo2005 on October 26, 2005, 08:31:02 PM
Okay danke! Also so viel Ahnung habe ich leider nicht, aber ich werde es versuchen (danke für den Link)!

Da ich dafür bestimmt mehr Zeit benötige, werde ich den MOD vorerst ohne diese Funktion online stellen.

Danke nochmals by Flo2005
Title: Re: PM to owner of image when Comment ist posted
Post by: Zyga on December 25, 2005, 10:44:37 PM
thx works great

can I add check box to user panel ?

edit : I resolve it (like receive email when PM - new field in DB)
-------------------------------------------------------------------------------

but again i have problem

i receive PM but when i click on it
site works but over i see

Quote
DB Error: Bad SQL Query: SELECT COUNT(pm_id) AS total FROM 4images_pm WHERE pm_from = AND (pm_type = 2 OR pm_type = 0)
You have an error in your SQL syntax near 'AND (pm_type = 2 OR pm_type = 0)' at line 3

please help !
code is like it was :/ i change nothing

i dont know with one code fragment should i paste here
Title: Re: PM to owner of image when Comment ist posted
Post by: dosensteck on January 09, 2006, 03:57:27 PM
verwende den mod nochimmer, jetzt komme ich einmal mit einem problem - und mit einer weiterführenden idee

problem: hat ein user im bildtitel ein ' geschrieben bekommt man beim kommentarposten einen sql fehler :/


edit: das ist der fehler:
Code: [Select]
DB Error: Bad SQL Query: INSERT INTO 4images_pm (pm_date, pm_to, pm_from, pm_subject, pm_type, pm_text, pm_bbcode, pm_html, pm_ip, pm_smiles) VALUES ('1136821809', 7, 2, '"Let's Zeitung zerfetz'" hat ein Kommentar erhalten', 5, 'Das folgende Bild hat ein Kommentar erhalten: [B]Bild:[/B] [url=http://www.hobby-fotografen.com/details.php?image_id=1578]Let's Zeitung zerfetz'[/url] [url=http://www.hobby-fotografen.com/details.php?image_id=1578][img]./data/thumbnails/16/1578.jpg[/img][/url] [B]Überschrift:[/B] [B]Kommentar:[/B] nur wegen dem fernsehprogramm :D netter kleiner, also können wir davon ausgehen das da jetzt öfter fotos von ihm auftauchen? *g* lg -- Mit freundlichen Grüßen, euer hobby-fotografen.com Team', 1, 0, 'd5e52692', 1)
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 's Zeitung zerfetz'" hat ein Kommentar erhalten', 5, 'Das folgen

idee: wäre es möglich diese funktion auf alle user auszuweiten? ich stelle mir das so vor - der user kann einen button klicken, somit wird die user_id des users in ein extrafeld in der images tabelle geschrieben. wird nun ein neues kommentar geschrieben werden die user_ids der user ausgelsen die sich eingetragen haben und diese bekommen dann auch eine pm.

ich traue es mir leider nochnicht wirklich zu das selbst zu schreiben. habe zwar ein paar modifikationen an meiner page selbst gemacht (einfaches creditsystem - rahmen per css die der user selbst definieren kann), das geht für mich dann aber doch zuweit :/ (würde aber helfen wo es nur geht :D)
Title: Re: PM to owner of image when Comment ist posted
Post by: JensF on January 22, 2006, 09:19:59 PM
Hi,

also ne an/aus Funktion wäre echt nicht schlecht. Suche das auch noch für den Mail Mod bei neuen Kommentaren. Lies sich irgendwie nicht einbauen. Vielleicht hat das ja schon jemand in Angriff genommen ;)
Title: Re: PM to owner of image when Comment ist posted
Post by: Stoleti on January 22, 2006, 09:21:37 PM
doesn't exist any way to make it work for old PMS ?

 :wink:
Title: Re: PM to owner of image when Comment ist posted
Post by: Zyga on February 03, 2006, 09:15:46 PM
If some one could help me I would ge gratefull

mod works but I discover my "pm" or "not pm" radio button wont work withot little addons in code :?
I mean data is put in DB but I dont know how tu put working "if" to code
field name is comments_to_pm (1/0) and its in users table

I need something like

Code: [Select]
$site_db->query($sql);
     $commentid = $site_db->get_insert_id();
     update_comment_count($id, $user_info['user_id']);

below
Code: [Select]
if comments_to_pm=1 {

here whole code from first page
}

Title: Re: PM to owner of image when Comment ist posted
Post by: trez on February 08, 2006, 01:54:14 PM
great MOD - thanks !  :)
Title: Re: PM to owner of image when Comment ist posted
Post by: Zyga on March 30, 2006, 05:51:20 PM
one more idea
when someone post comment...
in PM we receive info who send this PM
Code: [Select]
$pm_from = 1; where 1 is user id
in most cases user_id 1 is gallery admin

what should i change to show in PM....
pm from "system" (or something simmiliar like "comment") without reply button and link to user profile

PS. maybe someone could help with code problem from 2 post ago
Title: Re: PM to owner of image when Comment ist posted
Post by: IcEcReaM on March 30, 2006, 06:20:17 PM
do it like this:
Code: [Select]
if ($user_info['comments_to_pm']) {
   here whole code from first page
}

for your notify problem.
Title: Re: PM to owner of image when Comment ist posted
Post by: Stoleti on April 01, 2006, 02:28:28 AM
doesn't exist any way to make it work for old PMS ?

 :wink:

anyone ???  8O
Title: Re: PM to owner of image when Comment ist posted
Post by: Zyga on April 06, 2006, 06:41:19 PM
do it like this:
Code: [Select]
if ($user_info['comments_to_pm']) {
   here whole code from first page
}

for your notify problem.

hmmmmmm in this case it take from DB info about comments_to_pm field from comment's autor not image owner 
Title: Re: PM to owner of image when Comment ist posted
Post by: IcEcReaM on April 06, 2006, 07:42:34 PM
oh, you are right.

you should use:
if ($image_row['user_id']) {
   here whole code from first page
}

$image_row['user_id'] is the image owner's user_id
Title: Re: PM to owner of image when Comment ist posted
Post by: Zyga on April 07, 2006, 05:05:07 PM
oh, you are right.

you should use:
if ($image_row['user_id']) {
   here whole code from first page
}

$image_row['user_id'] is the image owner's user_id

hmmmm i dont understeand   :cry:
it takes user_id field not comments_to_pm and (correct me if im wrong) it takes it from image table not users
Title: Re: PM to owner of image when Comment ist posted
Post by: Frobman on May 13, 2006, 11:55:13 AM
Quote
but again i have problem

i receive PM but when i click on it
site works but over i see


Quote
DB Error: Bad SQL Query: SELECT COUNT(pm_id) AS total FROM 4images_pm WHERE pm_from = AND (pm_type = 2 OR pm_type = 0)
You have an error in your SQL syntax near 'AND (pm_type = 2 OR pm_type = 0)' at line 3

please help !
code is like it was :/ i change nothing

i dont know with one code fragment should i paste here

@Zyga: how did you solve the problem? (i´ve the same Error-Message)

Thx Frobman
Title: Re: PM to owner of image when Comment ist posted
Post by: Zyga on May 13, 2006, 04:06:03 PM
Quote
but again i have problem

i receive PM but when i click on it
site works but over i see


Quote
DB Error: Bad SQL Query: SELECT COUNT(pm_id) AS total FROM 4images_pm WHERE pm_from = AND (pm_type = 2 OR pm_type = 0)
You have an error in your SQL syntax near 'AND (pm_type = 2 OR pm_type = 0)' at line 3

please help !
code is like it was :/ i change nothing

i dont know with one code fragment should i paste here

@Zyga: how did you solve the problem? (i´ve the same Error-Message)

Thx Frobman

sorry but I do nothing it just start works few days later
I dont know how can I help
Title: Re: [MOD] PM to owner of image when Comment ist posted
Post by: impss on February 28, 2007, 04:08:39 AM
Im getting this error as others have

Code: [Select]
DB Error: Bad SQL Query: SELECT COUNT(pm_id) AS total FROM 4images_pm WHERE pm_from = AND (pm_type = 2 OR pm_type = 0)
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND (pm_type = 2 OR pm_type = 0)' at line 3

any help?

thanks
Title: Re: [MOD] PM to owner of image when Comment ist posted
Post by: Flo2005 on February 28, 2007, 06:39:09 AM
Im getting this error as others have

Code: [Select]
DB Error: Bad SQL Query: SELECT COUNT(pm_id) AS total FROM 4images_pm WHERE pm_from = AND (pm_type = 2 OR pm_type = 0)
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND (pm_type = 2 OR pm_type = 0)' at line 3

any help?

thanks

Which PHP Version is running on your server?

I´ll remember  :? you have to change something in pm.php when you´re running PHP5
Title: Re: [MOD] PM to owner of image when Comment ist posted
Post by: impss on February 28, 2007, 07:05:25 AM
Yea.. im running PhP5

correct this part:

$pm_from = 0; //Hier bitte die user_id vom Absender angeben
'

do i change that to a 1?
Title: Re: [MOD] PM to owner of image when Comment ist posted
Post by: impss on February 28, 2007, 03:26:27 PM
Thank you it looks to be working. And Thanks for the quick responce
 8)


Is there any way to change it so the Pm is sent from the commenter?
Title: Re: [MOD] PM to owner of image when Comment ist posted
Post by: Jan-Lukas on June 02, 2007, 01:25:31 AM
hi zusammen,
wäre es möglich bei pm_from anstatt immer den admin zu nehmen
die entsprechende id des absenders zu nehmen?

und wenn es ein gast ist, auch gast im der kopfzeile erscheint....

gruss ivan

Hbe es mir auch gerade eingebaut, und finde auch das dort die ID des Absenders reingehört.
Über eine Lösung würde ich mich freuen

Danke
Harald