Thread Rating:
  • 3 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple C(ontact) Plugin (fork of p01-contact)
#1
Brick 
Hello everybody,
I am opening this thread to create a home for anybody who might like to use my (temporary) fork of the popular p01-contact plugin created by Nicolas Liautaud.

I liked that plugin a lot, and being that I needed to improve it for my own needs, I decided to share my improvements with the community.

You can download it from this page:
http://get-simple.info/extend/plugin/simple-c/784/

The main improvements are about being able to set the form language on a per-form basis and the ability to translate the plugin using other standard plugins, since it has been converted to comply with the i18n guidelines of GetSimple.

Thanks a lot Nicolas for sharing p01-contact and thanks also to Chris for sharing GetSimple!

Update: the improvements I've made to p01-contact are going to be added directly to p01-contact or eventually to its successor, FormSimple. That means that this "Simple-C" plugin will not see any new version unless anybody needs a quick and dirty fix or small further improvement.

2014-05-16 BUG notice: you MUST use the per-form language tag form - that is, use (% simplec: formlang = en %) instead of (% simplec %) - as the setting in the plugin settings page seems to get ignored. Hopefully going to get fixed soon.

Bests,
Francesco
Reply
#2
Wink 
Having problems changing the {simple-c//name} to just name
all of the other titles do the same thing.

thank you

[Image: simplecform.jpg]
Reply
#3
Hi,

same problem if i use my own config like this:

Code:
select! "Anfrage" = "Kontaktanfrage" selected | "Terminanfrage", name!, phone!"Telefon", email!, message, captcha, askcopy, subject => Anfrage

Any solution to fix this ?
Reply
#4
Hello everybody,
sorry for the very late reply.

There is a bug in my code, the language setting in the plugin page seems to get ignored.

The workaround is to specify the language on a per-form basis, using this tag form: (% simplec: formlang = en %), (% simplec: formlang = fr %) and so forth.

As soon as I get a bit of spare time I'll fix this bug, and I'll continue working on this branch of FormSimple, which is the designated replacement both for the original "p01-contact" and for my "Simple C(ontact) " temporary version.

Bests,
Francesco
Reply
#5
short question, currently i use p01-contact form but i like to switch now and i need some
instructions what i have to do to change the display with css for this plugin.

If i use old p01 css it does not work andy sample css code for this plugin existing
Reply
#6
(2014-10-13, 04:33:56)phpman Wrote: short question, currently i use p01-contact form but i like to switch now and i need some
instructions what i have to do to change the display with css for this plugin.

If i use old p01 css it does not work andy sample css code for this plugin existing

Hello,
the CSS classes and IDs of the markup generated by my plugin are different from those of p01-contact, and any CSS you may be using will not work for that reason.

Since my plugin does not ship any CSS file, and p01-contact doesn't either, I think you must be using some other CSS customized for your current installation.

In my markup all occurrences of the string "p01-contact" are replaced by "simple-c", to solve that you should try replacing that string in your CSS rules accordingly, and then you should get your styling back.

For example, if you have a rule that adds a border around the form like this:

Code:
form.p01-contact {
  border: 1px solid #000;
}

you should change it like this:

Code:
form.simple-c {
  border: 1px solid #000;
}

Also, don't forget that there still is a bug in my code that doesn't let it use the default language of your GetSimple installation, for that reason you need to use, in your pages, a string like this:

Code:
(% simplec: formlang = en %)

instead of this:

Code:
(% simplec %)

Hope the above helps you fix the problems. If it doesn't, please feel free to post your further questions along with any additional detail.

Bests,
Francesco
Reply
#7
Question 
I'm trying to use this in a site's sidebar. I have the following code in my page template:
Code:
<!-- component start -->                            
          <div class="section">                  
            <?php get_component('sidebar');                  
            echo $SimpleC->parse('(% simplec: formlang = en %)'); ?>
          </div>  
<!-- component end -->

The other sidebar contents are displayed but the form isn't. What am I missing?
Reply
#8
I solved my problem by creating a page containing the shortcode and including it with getPageContent('myPage') as described in this post.
Reply
#9
look at my fork http://get-simple.info/extend/plugin/sim...-fork/914/
if you planing to improve your plugin and implement all my features i can delete it
sorry, my english not so good to read forums and having a long discussions
may be you speak russian?
Reply
#10
even more features you can add manually
in file label.php, after
PHP Code:
$class 'form-group has-feedback';    // class for label parent <div> 
you can place:
PHP Code:
switch ($this->type) {
case 
"email":
$class .= ' col-sm-6';
break;
case 
"message":
$class .= ' col-md-12';
break;

for any exra classes depended of field type
types can be:
PHP Code:
'name'
'email'
'phone'
'website'
'subject'
'address'
'message'
'file'
'captcha'
'askcopy' 
also remeber this fork was develeped for personal reason and wasn't well tested
if you have some problem try to replace all strings like
PHP Code:
$class 'btn btn-primary btn-lg'
to
PHP Code:
$class ''
Reply
#11
Hi, I got a problem, if the Name field has something like
ê ç é or similar I get weird headers like Voc&ecirc on the from: field of my mail client. Is there any way to fix that?
Reply
#12
After days trying finally found something:
I deleted line 285 $tmp = htmlentities($tmp, ENT_QUOTES, 'UTF-8');
and line 806 $subject = '=?utf-8?B?' . base64_encode($subject) . '?=';
now working perfect.
Reply
#13
I get error
Quote: Error : no message was sent.
What can be the reason? I tried "p01-contact" and it's fork "Simple C(ontact)" and even fork of this fork..

Well, looks like hoster disabled mail() function for some reason.. What other solution can be used for setting a message form on the GS website?
Reply
#14
After surfing a while I found several solutions to send messages via smtp function. However, due to poor PHP skills i cannot use this function in this plugin. Can someone help?
Here I am attaching function for smtp:
Code:
<?php
  $config['smtp_username'] = 'my@mail.com';  // put your email
  $config['smtp_port']   = '25'; // usually
  $config['smtp_host']   = 'smtp.mail.com';  //or could be ssl://smtp.mail.com
  $config['smtp_password'] = 'pass';  //mail password
  $config['smtp_debug'] = true;  //show mistakes
  $config['smtp_charset']  = 'UTF-8';  //encoding
  $config['smtp_from']   = 'Mister Nobody'; //Your name
function smtpmail($mail_to, $subject, $message, $headers='') {
  global $config;
  $SEND = "Date: ".date("D, d M Y H:i:s") . " UT\r\n";
  $SEND .=  'Subject: =?'.$config['smtp_charset'].'?B?'.base64_encode($subject)."=?=\r\n";
  if ($headers) $SEND .= $headers."\r\n\r\n";
  else
  {
      $SEND .= "Reply-To: ".$config['smtp_username']."\r\n";
      $SEND .= "MIME-Version: 1.0\r\n";
      $SEND .= "Content-Type: text/plain; charset=\"".$config['smtp_charset']."\"\r\n";
      $SEND .= "Content-Transfer-Encoding: 8bit\r\n";
      $SEND .= "From: \"".$config['smtp_from']."\" <".$config['smtp_username'].">\r\n";
      $SEND .= "To: $mail_to <$mail_to>\r\n";
      $SEND .= "X-Priority: 3\r\n\r\n";
  }
  $SEND .=  $message."\r\n";
   if( !$socket = fsockopen($config['smtp_host'], $config['smtp_port'], $errno, $errstr, 30) ) {
    if ($config['smtp_debug']) echo $errno."<br>".$errstr;
    return false;
   }

  if (!server_parse($socket, "220", __LINE__)) return false;

  fputs($socket, "HELO " . $config['smtp_host'] . "\r\n");
  if (!server_parse($socket, "250", __LINE__)) {
    if ($config['smtp_debug']) echo '<p>cannot send HELO!</p>';
    fclose($socket);
    return false;
  }
  fputs($socket, "AUTH LOGIN\r\n");
  if (!server_parse($socket, "334", __LINE__)) {
    if ($config['smtp_debug']) echo '<p>cannot find request for authorization.</p>';
    fclose($socket);
    return false;
  }
  fputs($socket, base64_encode($config['smtp_username']) . "\r\n");
  if (!server_parse($socket, "334", __LINE__)) {
    if ($config['smtp_debug']) echo '<p>Login is not correct</p>';
    fclose($socket);
    return false;
  }
  fputs($socket, base64_encode($config['smtp_password']) . "\r\n");
  if (!server_parse($socket, "235", __LINE__)) {
    if ($config['smtp_debug']) echo '<p>PAssword was not accepted</p>';
    fclose($socket);
    return false;
  }
  fputs($socket, "MAIL FROM: <".$config['smtp_username'].">\r\n");
  if (!server_parse($socket, "250", __LINE__)) {
    if ($config['smtp_debug']) echo '<p>Cannot use command MAIL FROM: </p>';
    fclose($socket);
    return false;
  }
  fputs($socket, "RCPT TO: <" . $mail_to . ">\r\n");

  if (!server_parse($socket, "250", __LINE__)) {
    if ($config['smtp_debug']) echo '<p>Cannot use command RCPT TO: </p>';
    fclose($socket);
    return false;
  }
  fputs($socket, "DATA\r\n");

  if (!server_parse($socket, "354", __LINE__)) {
    if ($config['smtp_debug']) echo '<p>Cannot use command DATA</p>';
    fclose($socket);
    return false;
  }
  fputs($socket, $SEND."\r\n.\r\n");

  if (!server_parse($socket, "250", __LINE__)) {
    if ($config['smtp_debug']) echo '<p>The message body was not sent!</p>';
    fclose($socket);
    return false;
  }
  fputs($socket, "QUIT\r\n");
  fclose($socket);
  return TRUE;
}

function server_parse($socket, $response, $line = __LINE__) {
  global $config;
  while (@substr($server_response, 3, 1) != ' ') {
    if (!($server_response = fgets($socket, 256))) {
      if ($config['smtp_debug']) echo "<p>Problems!</p>$response<br>$line<br>";
      return false;
    }
  }
  if (!(substr($server_response, 0, 3) == $response)) {
    if ($config['smtp_debug']) echo "<p>Problems!</p>$response<br>$line<br>";
    return false;
  }
  return true;
}
?>

this code should be saved and called instead of mail() function.. But how? (
Reply
#15
Are you sure that the function mail() is blocked?
I have some problem because of changed rules by my hosting provider.
To solve it I was just add "admin email" in control panel.

also my provider doesn't support any mail function like sendmail() or SMTP.

But if you are sure
you can change

send_mail() in p01-contact.php
you need fo find block:
if(!$this->settings('debug')) {
...
} else {
and make some changes to string
$status = mail($targets, $subject, $content.$footer, $headers);

my PHP skills not so big and I need a lot of time to test it. so I will not

sorry for my lang
Reply
#16
Thank you, wakh!
Yes, I've talked to hoter and they are not going to change their policy, they asked to use smtp instead of mail()
and my php skills are also not good enough, to use smtp function instead of mail().

Can someone edit this plugint to make it work?

Thank you!
Reply




Users browsing this thread: 1 Guest(s)