Add contact form

This is the right place to report general bugs, make suggestions or ask for help.
Post Reply
Hariko
Posts: 8
Joined: Tue Feb 07, 2023 8:23 pm

Add contact form

Post by Hariko » Tue Feb 07, 2023 8:35 pm

I would like to add a note to the contact form that the data will be processed according to the privacy policy. (With link to privacy policy) How can I add the text to the form?

User avatar
fraenkiman
Posts: 210
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: Add contact form

Post by fraenkiman » Wed Feb 08, 2023 2:17 pm

Hello Hariko,

welcome on board.
You can edit the template fp-interface/sharedtpls/contact.tpl for this purpose.

With best regards
Frank
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

Hariko
Posts: 8
Joined: Tue Feb 07, 2023 8:23 pm

Re: Add contact form

Post by Hariko » Wed Feb 08, 2023 3:55 pm

Hello Frank,
I have now simply found the right place by trial and error and entered the text there (see below)
It works, but this can not be correct way? Firstly, this looks completely unprofessional and secondly, it will be overwritten during an update or?
greetings
Hariko

</fieldset>

<fieldset><legend>{$lang.contact.fieldset2}</legend>
<p><label for="content">{$lang.contact.comment}</label><br />
{if isset($error) && isset($error.content) && !empty($error.content)}
{assign var=class value="field-error"}
{else}
{assign var=class value=""}
{/if}
{if isset($values) && isset($values.content) && !empty($values.content)}
{assign var=contentvalue value=$values.content}
{else}
{assign var=contentvalue value=""}
{/if}
<textarea name="content" id="content" class="{$class}"
rows="10" cols="74">{$contentvalue|stripslashes|wp_specialchars:true}</textarea></p>

Wir verwenden deine Daten gemäß unserer <a href="https://xxxxxxxxxxxx.de/?page=datenschutz" title=" Datenschutzerklärung">Datenschutzerklärung</a>

</fieldset>

<div class="buttonbar">
<input type="submit" name="submit" id="submit" value="{$lang.contact.submit}" />
<input type="reset" name="reset" id="reset" value="{$lang.contact.reset}" />
</div>

</form>

User avatar
fraenkiman
Posts: 210
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: Add contact form

Post by fraenkiman » Wed Feb 08, 2023 6:16 pm

Hello Hariko,

the template will be overwritten during an update. You can style the hint text via the corresponding css file.

Alternatively, you can use a plugin and customize it to your needs.
Take a look at the CookieGuard plugin.

With best regards
Frank
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

Hariko
Posts: 8
Joined: Tue Feb 07, 2023 8:23 pm

Re: Add contact form

Post by Hariko » Sat Feb 11, 2023 8:00 pm

Hello,
I wanted to create a simple plugin that displays the text directly over the submit button,
but I can't do it. No text appears. What is the reason for this?
Greetings
Hariko


add_filter('fp_contactform_before_submit_button', 'add_notice_text');

function add_notice_text($form) {
$notice_text = "Wir verarbeiten Ihre Daten gemäß unserer <a href='https://www.example.com/datenschutz'>Da ... klärung</a>.";
return $form .= "<p><em>" . $notice_text . "</em></p>";
}

User avatar
Arvid
FlatPress Coder
Posts: 558
Joined: Sat Jan 26, 2019 7:40 pm
Contact:

Re: Add contact form

Post by Arvid » Sat Feb 11, 2023 9:27 pm

Hi and welcome aboard :)

Nice idea, this plugin! And a great plugin example to start with :)
Without being really involved yet: Your function returns an assignment. Simply remove the "=":

Code: Select all

return $form . "<p><em>" . $notice_text . "</em></p>";
All the best,
Arvid

Hariko
Posts: 8
Joined: Tue Feb 07, 2023 8:23 pm

Re: Add contact form

Post by Hariko » Sat Feb 11, 2023 10:56 pm

Unfortunately, I can't make it work, it's always the same problem with these open-source projects. As a normal mortal user are always quickly reached the limits, and it is assumed that you have to learn before using the program various things, in this case HTML, PHP, CSS and so on. Simply applying is not possible. So, it always remains a tool for enthusiasts. Actually, a pity.

User avatar
fraenkiman
Posts: 210
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: Add contact form

Post by fraenkiman » Sun Feb 12, 2023 12:56 am

Hello Hariko,

probably an anchor is missing in the template contact.tpl for this. But you can use the anchor {comment_form}, which is normally used by the plugin Accessible Antispam. This also has the advantage that if a visitor wants to leave a comment, he then also gets the reference to the privacy policy displayed. Try this plugin.

Best regards
Frank
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

User avatar
Arvid
FlatPress Coder
Posts: 558
Joined: Sat Jan 26, 2019 7:40 pm
Contact:

Re: Add contact form

Post by Arvid » Sun Feb 12, 2023 8:02 am

Okay, two steps back: What if you just copy&paste the Leggero theme, and rename the copy to, say, "Hariko"? Then you'd be able to edit the contact form template to your needs without having to fear losing it with the next update.

Let us know if that helps :)
All the best
Arvid

Update: Ah, I see, Frank created a plugin :)

Post Reply

Who is online

Users browsing this forum: No registered users and 47 guests