1 (edited by alias 2009-09-08 13:24)

Topic: i got some problem to find variables

Hi, i try to send a mail with some information when user tryes to edit a post and submit post modificated.
I find the following data:
1 - original message -> $cur_post['message']
2 - original subject of the post -> $cur_post['subject']

Now i'm trying (and i didn't find yet) variables for:
1 - post url  ... maybe 'f.redirect_url'? to send the link by mail
2 - username that change the post ... maybe $pun_user['username']?

After i find that i want to send an "hidden to user" mail to administrator/moderator using php mail function when i confirm the submit button on edit.php.

<form id="edit" method="post" action="edit.php?id=<?php echo $id ?>&amp;action=edit" onsubmit="return process_form(this)">

How can i add another function on "submit" event?

Thank you and sorry for my "terrible" english language tongue

Re: i got some problem to find variables

alias wrote:

1 - post url  ... maybe 'f.redirect_url'? to send the link by mail

This code generates link to the edited post:

viewtopic.php?pid=<?php echo $id.'#p'.$id ?>">
alias wrote:

username that change the post ... maybe $pun_user['username']?

Yes, it is. All information about user stored in the $pun_user variable.

alias wrote:

How can i add another function on "submit" event?

Message send php, not JavaScript, you don't need to add some other events. After post updating to send message you need to use PunBB function pun_mail($to, $subject, $message, $from = '').


Re: i got some problem to find variables

ok, i've tried for hours sad and i'm in the fog....

i'm running punbb in localhost to perform change to prevent online errors for users...
i made an echo of pun_user['username'] and nothing print..... seems i ain't got a pun_user, but it's impossible (i'm logged with admin profile, i supposed Admin is a particular case of an user).

ok, next step...
i wrote in my code: require FORUM_ROOT.'include/email.php';
but when i test the page an error occourred about finding "email.php" , where i'm wrong?? it couldn't find this filw and i've got it in that path sad

last step (maybe one day i will offer you a beer for the patience)
for post link i must write something like this?

<a href="viewtopic.php?pid=<?php echo $id.'#p'.$id ?>"> link here </a>

maybe i'm stupid but i can't find this error...
Thanks!!! big_smile


Re: i got some problem to find variables

i solve most of my problems, thanks however.....only one problem i didn't solve yet....
pun_mail doesn't exists in path include/email.php
and so i got to use smtp_mail() or forum_mail() function...which better? hmm


Re: i got some problem to find variables

function secretMail(){
    require FORUM_ROOT.'include/email.php';
    $to = $forum_config['o_webmaster_email'];
    $object = 'è stato modificato un post';        //e mail subject
    $from = $forum_name;        //from who?
    $url = FORUM_ROOT.'viewtopic.php?pid='.$id.'#p'.$id;    // $root contains modificated topic address
    $message =  '<p>messaggio originale:</p><p>'.$cur_post['message'].'</p><p>per visualizzare il messaggio modificato segui questo link:</p>'.'<a href="'.$url.'">link</a>'; //message
    forum_mail($to,$object,$message); //forum_mail function contained in email.php included above

here is my code, but i don't know how to put the function call hmm
if i put the call before
redirect(forum_link($forum_url['post'], $id), $lang_post['Edit redirect']);
on line 166 mail is sent only if i click submit button, but if i click preview and after submit email isn't sent.

i think i can put that call on line 170 in the "empty line" after everything but i can't see if that works because i'm working on localhost and i can send to myself email (for now, i'm working on this with a free servermail smile).

thanks! wink

Re: i got some problem to find variables

This line is the best place for the function call. If you use some kind of e-mail server emulators, e-mail letters should placed in some tmp directory.