Revision history for FeedbackAction


Revision [22929]

Last edited on 2016-05-20 07:38:42 by JavaWoman [Replaces old-style internal links with new pipe-split links.]
Additions:
<<An upgrade of this action, working as a module for the **UserAdmin** tool or as a standalone action, is available [[FeedbackActionUpgrade | here]]<<
echo $this->Format("Return to the [[".$this->GetConfigValue("root_page")." | main page]]");
Deletions:
<<An upgrade of this action, working as a module for the **UserAdmin** tool or as a standalone action, is available [[FeedbackActionUpgrade here]]<<
echo $this->Format("Return to the [[".$this->GetConfigValue("root_page")." main page]]");


Revision [18219]

Edited on 2008-01-28 00:10:39 by JavaWoman [Modified links pointing to docs server]

No Differences

Revision [3332]

Edited on 2004-12-16 20:51:15 by JavaWoman [minor edit for readability]
Additions:
after saving the modified code as **mail.php** in the actions folder, you can address me with the action ""{{mail to="DreckFehler"}}"" or simply place a ""{{mail}}"" onto your personal userpage to have a contact-form without publishing your email-address (don't echo the address in the tnx-message ;) this should rather be changed to "...your feedback has been sent to ""[[".$to."]] ---"""). -- DreckFehler
Deletions:
after saving the modified code as **mail.php** in the actions folder, you can address me with the action ""{{mail to="DreckFehler"}}"" or simply place a ""{{mail}}"" onto your personal userpage to have a contact-form without publishing your email-address (don't echo the address in the tnx-message ;) this should rather be changed to "...your feedback has been sent to ""[[".$to."]]"" ---"). -- DreckFehler


Revision [2942]

Edited on 2004-12-07 22:59:59 by JavaWoman [minor edits for better layout]
Additions:
replace the line **""$recipient = $this->GetConfigValue("admin_email");""** with the following:
after saving the modified code as **mail.php** in the actions folder, you can address me with the action ""{{mail to="DreckFehler"}}"" or simply place a ""{{mail}}"" onto your personal userpage to have a contact-form without publishing your email-address (don't echo the address in the tnx-message ;) this should rather be changed to "...your feedback has been sent to ""[[".$to."]]"" ---"). -- DreckFehler
Deletions:
replace the line **$recipient = $this->GetConfigValue("admin_email");** with the following:
%%(php)<?php
?>%%
after saving the modified code as **mail.php** in the actions folder, you can address me with the action ""{{mail to="DreckFehler"}}"" or simply place a ""{{mail}}"" onto your personal userpage to have a contact-form without publishing your email-address (don't echo the address in the tnx-message ;) this should rather be changed to "...your feedback has been sent to [[".$to."]] ---"). -- DreckFehler


Revision [1518]

Edited on 2004-10-01 16:57:46 by DarTar [Fixed bug in Feedback Action]
Additions:
<form method="post" action="'.$this->tag.'&mail=result">
after saving the modified code as **mail.php** in the actions folder, you can address me with the action ""{{mail to="DreckFehler"}}"" or simply place a ""{{mail}}"" onto your personal userpage to have a contact-form without publishing your email-address (don't echo the address in the tnx-message ;) this should rather be changed to "...your feedback has been sent to [[".$to."]] ---"). -- DreckFehler
--
=== Bug found! ===
There is a bug in the feedback action when this is used on wikka installations that don't adopt rewriterules.
The submit button currently posts the form to:
##$this->tag.'?mail=result'##
which opens an invalid URL if rewrite_mode is set to "0" in ##wikka.config.php##.
The form should be posted instead to:
##$this->tag.'&mail=result'##
''Note: this should work in any case, whether rewrite_mode is set to "0" or "1"''
I've fixed the code above.
Deletions:
<form method="post" action="'.$this->tag.'?mail=result">
after saving the modified code as **mail.php** in the actions folder, you can address me with the action ""{{mail to="DreckFehler"}}"" or simply place a ""{{mail}}"" onto your personal userpage to have a contact-form without publishing your email-address (don't echo the address in the tnx-message ;) this should rather be changed to "...your feedback has been sent to [[".$to."]] ---"). -- DreckFehler


Revision [1270]

Edited on 2004-09-16 09:43:14 by DarTar [Fixed bug in Feedback Action]

No Differences

Revision [1269]

Edited on 2004-09-16 09:43:07 by DarTar [Fixed bug in Feedback Action]
Additions:
<<An upgrade of this action, working as a module for the **UserAdmin** tool or as a standalone action, is available [[FeedbackActionUpgrade here]]<<
Deletions:
<<A beta-upgrade of this action is available [[FeedbackActionUpgrade here]]<<


Revision [1234]

Edited on 2004-09-15 19:51:30 by DarTar [added link]
Additions:
=====Feedback Action=====

[''Note: The feedback action is now included in Wikka by default starting with Wikka 1.1.3.1'']

<<A beta-upgrade of this action is available [[FeedbackActionUpgrade here]]<<

This action displays a form for sending user feedback to the site administrator email, as specified in ##wakka.config.php##.
It first validates the form, then sends it using the mail() function and displays a "thanks for your feedback"message

To use it you will first need to save the code below in a file called ##feedback.php## in the actions folder.
Then simply add ""{{feedback}}"" in the page in which you want the feedback form to be displayed.

-- DarTar

%%(php)
<?php

// Displays a form to send feedback to the site administrator, as specified in wakka.config.php
// It first validates the form, then sends it using the mail() function;

$form = '<p>Fill in the form below to send us your comments:</p>
<form method="post" action="'.$this->tag.'?mail=result">
Name: <input name="name" value="'.$_POST["name"].'"type="text" /><br />
Email: <input name="email" value="'.$_POST["email"].'" type="text" /><br />
Comments:<br />
<textarea name="comments" rows="15" cols="40">'.$_POST["comments"].'</textarea><br />
<input type="submit" />
</form>';

if ($_GET["mail"]=="result") {
$name = $_POST["name"];
$email = $_POST["email"];
$comments = $_POST["comments"];
list($user, $host) = sscanf($email, "%[a-zA-Z0-9._-]@%[a-zA-Z0-9._-]");
if (!$name) {
// a valid name must be entered
echo "<p class=\"error\">Please enter your name</p>";
echo $form;
} elseif (!$email || !strchr($email, "@") || !$user || !$host) {
// a valid email address must be entered
echo "<p class=\"error\">Please enter a valid email address</p>";
echo $form;
} elseif (!$comments) {
// some text must be entered
echo "<p class=\"error\">Please enter some text</p>";
echo $alert;
echo $form;
} else {
// send email and display message
$msg = "Name:\t".$name."\n";
$msg .= "Email:\t".$email."\n";
$msg .= "Comments:".$comments."\n";
$recipient = $this->GetConfigValue("admin_email");
$subject = "Feedback from ".$this->GetConfigValue("wakka_name");
$mailheaders = "From:".$email."\n";
$mailheaders .= "Reply-To:".$email."\n\n";
mail($recipient, $subject, $msg, $mailheaders);
echo $this->Format("Thanks for your interest! Your feedback has been sent to [[".$recipient."]] ---");
echo $this->Format("Return to the [[".$this->GetConfigValue("root_page")." main page]]");
// optionally displays the feedback text
//echo $this->Format("---- **Name:** ".$name."---**Email:** ".$email."---**Comments:** ---".$comments);
}
} else {
echo $form;
}
?>
%%

with some simple modifications this form can be used to send a mail to any registered user.

the idea is to use either a given parameter "to" or the page-tag to fetch the mail-address out of the wakka_users table

replace the line **$recipient = $this->GetConfigValue("admin_email");** with the following:

%%(php)<?php
if (!$to) $to = $this->tag;
$record = $this->LoadUser($to);
if ($recipient = $record["email"]) {
// proceed with mailing
} else echo "<p class='error'>Sorry, can't address recipient</p>";
?>%%

Deletions:
=====Feedback Action=====

[''Note: The feedback action is now included in Wikka by default starting with Wikka 1.1.3.1'']

This action displays a form for sending user feedback to the site administrator email, as specified in ##wakka.config.php##.
It first validates the form, then sends it using the mail() function and displays a "thanks for your feedback"message

To use it you will first need to save the code below in a file called ##feedback.php## in the actions folder.
Then simply add ""{{feedback}}"" in the page in which you want the feedback form to be displayed.

-- DarTar

%%(php)
<?php

// Displays a form to send feedback to the site administrator, as specified in wakka.config.php
// It first validates the form, then sends it using the mail() function;

$form = '<p>Fill in the form below to send us your comments:</p>
<form method="post" action="'.$this->tag.'?mail=result">
Name: <input name="name" value="'.$_POST["name"].'"type="text" /><br />
Email: <input name="email" value="'.$_POST["email"].'" type="text" /><br />
Comments:<br />
<textarea name="comments" rows="15" cols="40">'.$_POST["comments"].'</textarea><br />
<input type="submit" />
</form>';

if ($_GET["mail"]=="result") {
$name = $_POST["name"];
$email = $_POST["email"];
$comments = $_POST["comments"];
list($user, $host) = sscanf($email, "%[a-zA-Z0-9._-]@%[a-zA-Z0-9._-]");
if (!$name) {
// a valid name must be entered
echo "<p class=\"error\">Please enter your name</p>";
echo $form;
} elseif (!$email || !strchr($email, "@") || !$user || !$host) {
// a valid email address must be entered
echo "<p class=\"error\">Please enter a valid email address</p>";
echo $form;
} elseif (!$comments) {
// some text must be entered
echo "<p class=\"error\">Please enter some text</p>";
echo $alert;
echo $form;
} else {
// send email and display message
$msg = "Name:\t".$name."\n";
$msg .= "Email:\t".$email."\n";
$msg .= "Comments:".$comments."\n";
$recipient = $this->GetConfigValue("admin_email");
$subject = "Feedback from ".$this->GetConfigValue("wakka_name");
$mailheaders = "From:".$email."\n";
$mailheaders .= "Reply-To:".$email."\n\n";
mail($recipient, $subject, $msg, $mailheaders);
echo $this->Format("Thanks for your interest! Your feedback has been sent to [[".$recipient."]] ---");
echo $this->Format("Return to the [[".$this->GetConfigValue("root_page")." main page]]");
// optionally displays the feedback text
//echo $this->Format("---- **Name:** ".$name."---**Email:** ".$email."---**Comments:** ---".$comments);
}
} else {
echo $form;
}
?>
%%

with some simple modifications this form can be used to send a mail to any registered user.

the idea is to use either a given parameter "to" or the page-tag to fetch the mail-address out of the wakka_users table

replace the line **$recipient = $this->GetConfigValue("admin_email");** with the following:

%%(php)<?php
if (!$to) $to = $this->tag;
$record = $this->LoadUser($to);
if ($recipient = $record["email"]) {
// proceed with mailing
} else echo "<p class='error'>Sorry, can't address recipient</p>";
?>%%


Revision [860]

Edited on 2004-08-02 11:42:14 by DarTar [improved email parsing (case insensitive)]
Additions:
// Displays a form to send feedback to the site administrator, as specified in wakka.config.php
// It first validates the form, then sends it using the mail() function;
list($user, $host) = sscanf($email, "%[a-zA-Z0-9._-]@%[a-zA-Z0-9._-]");
Deletions:
list($user, $host) = sscanf($email, "%[a-z0-9._-]@%[a-z0-9._-]");


Revision [840]

Edited on 2004-08-01 15:24:54 by JsnX [improved email parsing (case insensitive)]
Additions:
[''Note: The feedback action is now included in Wikka by default starting with Wikka 1.1.3.1'']


Revision [828]

Edited on 2004-07-30 11:18:45 by DarTar [improved email parsing (case insensitive)]
Additions:
<form method="post" action="'.$this->tag.'?mail=result">
Deletions:
<form method="post" action="'.this->tag.'?mail=result">


Revision [792]

Edited on 2004-07-28 10:00:30 by DarTar [fixed code (target page for feedback form)]
Additions:
<form method="post" action="'.this->tag.'?mail=result">
Deletions:
<form method="post" action="SendFeedback?mail=result">


Revision [789]

Edited on 2004-07-28 00:38:30 by DreckFehler [make it an universal mail-form]
Additions:
with some simple modifications this form can be used to send a mail to any registered user.
the idea is to use either a given parameter "to" or the page-tag to fetch the mail-address out of the wakka_users table
replace the line **$recipient = $this->GetConfigValue("admin_email");** with the following:
%%(php)<?php
if (!$to) $to = $this->tag;
$record = $this->LoadUser($to);
if ($recipient = $record["email"]) {
// proceed with mailing
} else echo "<p class='error'>Sorry, can't address recipient</p>";
?>%%
after saving the modified code as **mail.php** in the actions folder, you can address me with the action ""{{mail to="DreckFehler"}}"" or simply place a ""{{mail}}"" onto your personal userpage to have a contact-form without publishing your email-address (don't echo the address in the tnx-message ;) this should rather be changed to "...your feedback has been sent to [[".$to."]] ---"). -- DreckFehler


Revision [756]

Edited on 2004-07-19 07:49:25 by DarTar [improved email parsing]
Additions:
list($user, $host) = sscanf($email, "%[a-z0-9._-]@%[a-z0-9._-]");
} elseif (!$email || !strchr($email, "@") || !$user || !$host) {
Deletions:
} elseif (!$email || !strchr($email, "@")) {


Revision [754]

The oldest known version of this page was created on 2004-07-18 19:57:17 by DarTar [improved email parsing]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki