More contact forms

I'm using the send message plugin as my contact us form, but I would like to set up another contact form on another page (with different fields etc). Is that possible using the send message plugin?
 

Mark

Administrator
Staff member
yes, you can duplicate that plugin and change the names/references/paths so you have another.

Adding fields is very easy with that plugin, simply add the HTML fields and the PHP will sanitize and process the new fields automatically behind the scenes.
 
I made the duplicates and edits which I thought were needed but I'm still getting this error when I try to navigate to the new form:
Warning: require_once(./plugins/DonatePremium/rankings.php): failed to open stream: No such file or directory in /home/top10cha/public_html/index.php on line 354

Fatal error: require_once(): Failed opening required './plugins/DonatePremium/rankings.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/top10cha/public_html/index.php on line 354
 

Mark

Administrator
Staff member
That error means a file you are referencing does not exist. There is no hook location called "rankings".
 
I understand that but I'm not sure where that is coming from. I don't recall ever referencing a file called rankings.

Would you be willing to look at the plugin (just the sendmessage plugin that I attempted to duplicate and modify as per your suggestion) and see if you can tell where I went wrong? I'm quite new at this, I probably missed something simple.
 

Mark

Administrator
Staff member
we would need to see your plugin files in order to isolate what you have done wrong.
 

Mark

Administrator
Staff member
you need to rename the class and function names

Code:
class sendmessage extends base {
  function sendmessage() {
to

Code:
class donatepremium extends base {
  function donatepremium() {
Still looking to see what else is missed
 

Mark

Administrator
Staff member
ahh the action array part is the issue, we had a couple options how to get this to work, but I will include the simplest here for now. Be back in a few minutes
 

Mark

Administrator
Staff member
in plugins/DonatePremium create a file called: action_array.php with the following code:

Code:
$donatearray = array('donatepremium' => 1);

$action = array_merge($action, $donatearray);
The way this is handled with probably change in the future, but not anytime soon.
 
I'm putting this here so I don't need to start a new thread.

After sending a message using the contact form (/sendmessage/) it goes to a "thank you" page where it says "Thanks! Mail sent." Where am I able to edit this page? Not the text itself, I want to add fieldset tags around the text so it shows up better on the page and matches all the other pages of the site. Thanks :)
 

Mark

Administrator
Staff member
I'll post an update to this plugin today so it will use a thank you page template, rather than just the language variable.
 

Mark

Administrator
Staff member
so the basics is this

create a new template: plugins/SendMessage/thankyou.html

add this (style as desired):
Code:
<div>
{$lng->mail_sent}
</div>
edit plugins/SendMessage/sendmessage.php

find:
Code:
$TMPL['content'] = $LNG['mail_sent'];
Replace with:
Code:
  $TMPL['content'] =  $this->do_plugin_skin('./plugins/SendMessage','thankyou');
that should do it.
 

Mark

Administrator
Staff member
great, I will roll these changes and a few other improvements into the next release
 
I did find one little glitch in the sendmessage / donatepremium duplication that I did. It seems that even when I change the $LNG fields in DonatePremium/languages/english.php it's still pulling the info from the english.php file in the SendMessage folder. It's not a big deal to me at all but I wanted to put that out there in case anyone else wants to do something similar.

And it's strange because I can add new fields into DonatePremium/languages/english.php and it will grab those ones. Just not the duplicates.
 
Top