New Module: ContactOwner
rWatcher
Joined: 2005-09-06
Posts: 722 |
Posted: Wed, 2009-07-22 20:47 | |||
I've created a new module, called "ContactOwner" which should create a page in Gallery with a form that a website visitor can use to send an email to the site's owner. More information can be found on the module's wiki page: It can be downloaded from this post, or from my github account at: It seems there's some kind of compatability issue between my web server and Gallery's sendmail code which causes error messages whenever I hit the "Send" button, but in theory it should work fine on a properly configured Gallery setup. If anyone has the time to try it out, let me know how it works... ---
|
||||
Posts: 27300
Works for me! Thanks.
I suspect that my issue is more of a php/mail issue and not the module but when I get the email, it is all on one line:
This is what I sent:
But I think this might be hard to make work on the various send mail versions etc.
It would be nice if the from box could be populated from the logged in user.
Keep up the great work!
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 722
Weird, I just messed around with the line break code a bit, it might work better now.
Done!
Edit:
I've attached a second version, which includes bharat's changes for the recent API update. If you're running Beta 2 use the -fix.zip version. If you're using the latest version from Git use -git.zip instead.
Posts: 7994
I've pulled this into the contrib repo. Thanks!
---
Problems? Check gallery3/var/logs
bugs/feature req's | upgrade to the latest code | use git | help! vote!
Posts: 8
Hi,
how do i remove the User Options Sidebar.
i know i cant hide it with css without hiding the admin's sidebar.
any ideas?
Posts: 722
I'm not sure what you mean by "User Options Sidebar". Is this the options menu at the top of the screen?
Posts: 8
What i meant by User Options Sidebar
Posts: 722
You appear to be using some kind of custom theme. The sidebar is not part of my ContactOwner module, it's part of the Gallery theme. Specifically, it's generated by the file "page.html.php", located in "themes/THEMENAME/views" .
Posts: 8
is that so. thanks for the reply. i will look at it.
Posts: 8
funny,
i got to the path that you mentioned and can't find views directory. i changed to the matrix template and the sidebar still there.
where is it from ?? -_-..
Posts: 722
Here's the views directory for the default Gallery 3 theme:
http://github.com/gallery/gallery3/tree/master/themes/default/views
Are you using Gallery 3?
Posts: 8
actually no. i'm using Gallery 2. any ideas ?
Posts: 722
Sorry, no. I'm not familiar with Gallery 2 code at all. You'd probably have better luck if you asked in one of the Gallery 2 forums though.
Posts: 722
I've created an updated version of ContactOwner:
- Merged in ckieffer's CSS changes for Gallery 3 Git
- Updated for the new sidebar code in Gallery 3 Git
- Tested everything against current git (as of commit b6c1ba7ea6416630b2a44b3df8400a2d48460b0a)
It is attached here, and has been uploaded to my github account.
Posts: 722
New version of ContactOwner:
- I've changed all references of "user::active()->email" to "identity::active_user()->email" to allow the module to work against current Git (as of commit e45ea9359d6cb603be0bc28376d92883aa8d7c7e).
It is attached here, and has been uploaded to my github account.
Posts: 27300
rWatcher,
Thanks for your continued contribution and keeping the module up to date!
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 573
Nice app here.
I installed for the latest Git and obove Zip. Seems to work fine inside Gallery. However, I don't get emails through. Any ideas why?
A bit confused:
in admin there is an Owners email form. Is that the email of the webmaster? or should this be left empty
When filling out the web-form I see the email I entered in admin?
Is the mail sender not supposed to fill in his email, in order for webmaster to reply to the contact.
This may be obvious once mails are going through - but for now they don't :-/
all the best
HB
Posts: 722
Gallery uses PHP's mail function to send email's. Perhaps mail isn't configured properly on your web server?
Sure, you could use it for that. The module is capable of setting up two contact links -- One for the person who created / uploaded the item on the current page (which can change from photo to photo if your Gallery has multiple users), and one for the sites "owner" (this contact link would be the same on every page).
It will automatically fill in the email address of the current logged in user for the "From" line (this is for where the email was sent from). If the current visitor is not logged in, then they will need to manually fill in their email here.
Posts: 573
Sorry abaout the missing emails. It turned out that my host had mailserverdowntime over the weekend. Recieved everything tonight... and module works fine
A couple og requests on my part:
- The from is fine for admin but for the sender is to me strange. It's obvious where the mail is sent from, and an anonymous sender kan put in anything, confusing the webmaster where this came from. If this form is changed to "your email" (person filling out the form) and making that field obligatory. That way there is someone to reply to.
- If I Reply the mail I recieve it goes to:
... Who is that? If the above mail is added as from, reply should go to this person...
Hope you understand what I mean.
The from field could be changed to a text field only available to admin. That way admin can add a default text included in all mails, such as:
"Someone contacted you via. your mailform at yoursite.com, don't ignore this one, it's important!"
BTW Rwatcher very clean and valid modules you're adding for the new Gallery3. Most appreciated from here.
all the best
HB
Posts: 722
My goal was to lay out the To/From/Subject/Message fields to look like the "standard" compose email screens found in every email program I've ever used. If it seems confusing I guess I could change it a little bit.
I could add in some code to require a "From" email, but as there's no way to verify that the email a guest provides actually exists, that's only going to be of limited usefulness.
is the default "From" address that Gallery 3 uses in every email it sends. You can change this to something else, but there's no way to make the email come from the visitor who's filling out the contact form.
From the codex:
Adding in some admin-controlled default text should be doable.
Posts: 573
I am aware that the field will not verify wether the email exists but it will verify that it is an email and that the field is actually added by sender. Yes if that email could take the place of
, replies would easy.
A sender might forget to give up contact info. Since this is a webform, it's too late once sent off. By prompting for mail it's all in one place
all the best
HB
Posts: 722
I've finished up a new version of my ContactOwner module. This version includes the changes bharat made for compatibility with the current version of Gallery 3 on git. I've also added some code to require users to fill out the entire form in order to send the message and the module now does some basic checking to make sure the provided email address actually looks like an email. Additionally, I've added an admin field for an "Email Message Header", which is some admin-definable text that will be inserted into the beginning of every email sent using this module. Everything has been tested against the current Gallery 3 Git (as of commit 38f2784fbbb0661dc57627d2878cb640bbffe271) and works fine for me. It will definitely NOT work with Beta 3 and older, so please make sure you're using the current code before installing this module.
Posts: 573
Rwatcher: You have hardcoded a border around the contact form. May be in css. It stands out quite wild on dark background. To avoid this is it possible to remove the border code css entirely and let themers decide whether they want a border around content or not and if so, control this globally from scren.css
Again - I am concerned about upgrades and the need to remember too many hacks around G3 once this thing takes off
Other than that, nice work here as well. Might run over the css here for possible ideas and I will post it later
all the best
HB - http://www.image.agentura.dk
Posts: 1
hi thanx guys for all the contribs. im no coder at all and i keep getting these errors when i try to send emails through the contactowner. im sure that there is something missing in some send code somewere. i did all the things in the installation process but still the same:
Exception [ 0 ]: @todo SEND_MAIL_FAILED
1.
C:/xampp/htdocs/galleri/modules/gallery/libraries/Sendmail.php[ 89 ]
84 // The docs say headers should be separated by \r\n, but occasionaly that doesn't work and you 85 // need to use a single \n. This can be set in config/sendmail.php 86 $headers = implode($this->header_separator, $headers); 87 $message = wordwrap($this->message, $this->line_length, "\n"); 88 if (!$this->mail($to, $this->subject, $message, $headers)) { 89 throw new Exception("@todo SEND_MAIL_FAILED"); 90 } 91 return $this; 92 } 93 94 public function mail($to, $subject, $message, $headers) {
2.
C:/xampp/htdocs/galleri/modules/contactowner/controllers/contactowner.php[ 133 ] » Sendmail_Core->send()
128 ->to($str_emailto)
129 ->subject($str_emailsubject)
130 ->header("Mime-Version", "1.0")
131 ->header("Content-type", "text/html; charset=utf-8")
132 ->message($str_emailbody)
133 ->send();
134
135 // Display a message telling the visitor that their email has been sent.
136 $template = new Theme_View("page.html", "other", "Contact");
137 $template->content = new View("contactowner_emailform.html");
138 $template->content->sendmail_form = t("Your Message Has Been Sent.");
3.
{PHP internt anrop} » ContactOwner_Controller->sendemail()
4.
C:/xampp/htdocs/galleri/system/core/Kohana.php[ 330 ] » ReflectionMethod->invokeArgs( argument )
object
object ContactOwner_Controller(0) {
}
args
array(0)
325
326 // Start the controller execution benchmark
327 Benchmark::start(SYSTEM_BENCHMARK.'_controller_execution');
328
329 // Execute the controller method
330 $method->invokeArgs($controller, $arguments);
331
332 // Controller method has been executed
333 Event::run('system.post_controller');
334
335 // Stop the controller execution benchmark
5.
C:/xampp/htdocs/galleri/system/core/Event.php[ 208 ] » Kohana_Core::instance( argument )
0
NULL
203 Event::$data =& $data;
204 $callbacks = Event::get($name);
205
206 foreach ($callbacks as $callback)
207 {
208 call_user_func_array($callback, array(&$data));
209 }
210
211 // Do this to prevent data from getting 'stuck'
212 $clear_data = '';
213 Event::$data =& $clear_data;
6.
C:/xampp/htdocs/galleri/application/Bootstrap.php[ 67 ] » Event_Core::run( argument )
name
array(2) (
0 => string(6) "Kohana"
1 => string(8) "instance"
)
data
array(1) (
0 => NULL
)
62
63// End system_initialization
64Benchmark::stop(SYSTEM_BENCHMARK.'_system_initialization');
65
66// Make the magic happen!
67Event::run('system.execute');
7.
C:/xampp/htdocs/galleri/index.php[ 91 ] » require( argument )
what am i missing guys??
Posts: 11
edited....
after having problems, I uninstalled the module, deleted the folder on the server, and re-downloaded and re-installed
now it works fine...
Posts: 47
This module is great, but does nothing to block or prevent spam.
Posts: 424
rwatcher..is it possible to include the recaptcha in the contact form that comes included with gallery?
I have another request..not sure if you can work this in or not. I'm actually trying to use your contact module and turn it into a contact form where people can upload photos via the form and them the form email the photos along with their message. is it possible?!
Posts: 722
I've updated this module to include captcha support. The new version can be downloaded from here, or from my github.
Posts: 7994
Pulled!
---
Problems? Check gallery3/var/logs
bugs/feature req's | upgrade to the latest code | use git
Posts: 132
When guest send email report this error
Dang... Something went wrong!
We tried really hard, but it's broken.
Talk to your Gallery administrator for help fixing this!
Error log
20:33:52 +00:00 --- error: Exception [ 0 ]: @todo SEND_MAIL_FAILED /var/www/vhosts/ajorge.net/httpdocs/gallery3/modules/gallery/libraries/Sendmail.php [ 90 ] #0 /var/www/vhosts/ajorge.net/httpdocs/gallery3/modules/contactowner/controllers/contactowner.php(148): Sendmail_Core->send() #1 [internal function]: ContactOwner_Controller->sendemail('-1') #2 /var/www/vhosts/ajorge.net/httpdocs/gallery3/system/core/Kohana.php(331): ReflectionMethod->invokeArgs(Object(ContactOwner_Controller), Array) #3 [internal function]: Kohana_Core::instance(NULL) #4 /var/www/vhosts/ajorge.net/httpdocs/gallery3/system/core/Event.php(208): call_user_func_array(Array, Array) #5 /var/www/vhosts/ajorge.net/httpdocs/gallery3/application/Bootstrap.php(67): Event_Core::run('system.execute') #6 /var/www/vhosts/ajorge.net/httpdocs/gallery3/index.php(97): require('/var/www/vhosts...') #7 {main}
www.ajorge.net
Posts: 722
The error is saying that Gallery's Sendmail.php library was unable to send the message. Do you use any other modules that send emails (such as notification)? If so, do they generate the same error?
I'd guess the problem would be one of two things: Either php's mail function isn't set up properly on your server, or the mail server your using only accepts email from a specific "from" address, which is different from the one Gallery is set up to use (this is controlled on the Admin -> Settings -> Advanced screen, it's the gallery / email_from and email_reply_to values).
Posts: 1
Hello!
Could it be possible to implement a feature that allows writing custom text in the sidebar for example under the link? I would like to add something like "or if you prefer IRC contact nickname in IRCnet".
Thanks, aakkonen
Posts: 722
You can insert whatever text you want by editing the /modules/contactowner/views/contactowner_block.html.php file and inserting the desired text/html at the end.
Posts: 27300
You can use the codeblock module as well.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 1
Hi, I am new in the community and I have a question. I was testing with this module and I always receive the mails on my Hotmail junk folder. Any ideas about what do I need to do? I don't want my hotmail users to not receive it on their inbox. Thanks in advance!
Posts: 1857
The module sends an email to the site owner, so the users shouldn't be looking for an email.
If, however, the mail's going to the junkmail folder, there could be a huge number of reasons. It could just be the way you've configured your hotmail filters. You can also try to set up spf or domainkeys records.
Posts: 16
rWatcher,
how can I add more information to the right of the form? Which file do I edit?
Posts: 722
This file handles printing the actual email form:
https://github.com/rWatcher/gallery3-contrib/blob/master/3.0/modules/contactowner/views/contactowner_emailform.html.php
You could edit it to insert additional information above or below the form easily enough, although inserting text to the right might take a little more work.
Posts: 16
Thanks.
Can you point me in the direction of adding information to the right 0f the From and To fields (in that blank open area)?
I'd like to add a phone number and address in that space that not being used.
Thanks for your help.
Posts: 27300
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 16
Thanks floridave!!!
But, do I create a new file with this information or add it to an existing file?
Posts: 27300
Edit the existing file referenced above.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 80
Hiya,
I can't get this to work, I can't locate the php files I need to change
Posts: 80
the PHP files arent located where it is listed above, any ideas? really want to get a contact button or something on there
Posts: 27300
The file is in modules / contactowner / views / contactowner_emailform.html.php
If you can't see that then I suspect you don't have the module installed or you are using a different module.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 80
this is what I see in the PHP file you mentioned
Posts: 27300
OK that is the file you want to edit.
the stuff here with regular html that you will have to know. is what you would edit to add the stuff you want to add like a phone number or contact button.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 80
hmmm..strangely I havent changed anything and its working now!?!? Just so I know, what would I add to the above to get it to work? Sorry I am not fully understanding what I would have needed to do, just want to know so I can learn.
Posts: 80
also, at the moment it seems you dont have to be registered on the site to send a message, and its possible to edit the "TO" field, upon testing it still goes through to the owner email address but it seems abit messy. One other issue I am concerned about is spam, can a capture be added to this easily?
Posts: 27300
Perhaps your best bet is to start a new thread. Your requirements are different that the "adding information to the right 0f the From and To fields (in that blank open area)?"
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 1
Hi!
I need some help. My contact owner function does not work any longer.
Dang... Something went wrong!
85 // The docs say headers should be separated by \r\n, but occasionaly that doesn't work and you 86 // need to use a single \n. This can be set in config/sendmail.php 87 $headers = implode($this->header_separator, $headers); 88 $message = wordwrap($this->message, $this->line_length, "\n"); 89 if (!$this->mail($to, $this->subject, $message, $headers)) { 90 throw new Exception("@todo SEND_MAIL_FAILED");
Can you help to figure out what is the issue?
Thx,
Krisztian