Skip to content

Commit e97e2f3

Browse files
author
Antti Kuosmanen
committed
More logical order in README instructions
1 parent d180bd8 commit e97e2f3

1 file changed

Lines changed: 26 additions & 27 deletions

File tree

README.md

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -55,31 +55,6 @@ You can also install the plugin by directly uploading the zip file as instructed
5555

5656
## Filter / Action API
5757

58-
### Action: wplf_post_validate_submission
59-
60-
Triggers after the form validation is done.
61-
62-
Example use:
63-
64-
Send a thank you email to the email in the submission
65-
66-
```php
67-
add_action( 'wplf_post_validate_submission', 'my_email_thankyou' );
68-
function my_email_thankyou( $return ) {
69-
// do nothing if form validation failed
70-
if ( ! $return->ok ) {
71-
return;
72-
}
73-
74-
$name = sanitize_text_field( $_POST['name'] );
75-
$email = sanitize_email( $_POST['email'] );
76-
$to = "\"$name\" <$email>";
77-
$subject = __( 'Thank You For Submitting A Form' );
78-
$content = wp_sprintf( __('Thanks, %s for clicking Submit on this glorious HTML5 Form!'), $name );
79-
wp_mail( $to, $subject, $content );
80-
}
81-
```
82-
8358
### Filter: wplf_validate_submission
8459

8560
Used to add validation to your forms
@@ -105,7 +80,7 @@ function my_form_validation( $return ) {
10580
}
10681
```
10782

108-
### wplf_validate_submission example: Google ReCaptcha integration
83+
#### Example: Google ReCaptcha integration
10984

11085
```php
11186
/**
@@ -144,6 +119,31 @@ function wplf_recaptcha( $return ) {
144119
}
145120
```
146121

122+
### Action: wplf_post_validate_submission
123+
124+
Triggers after the form validation is done.
125+
126+
Example use:
127+
128+
Send a thank you email to the email in the submission
129+
130+
```php
131+
add_action( 'wplf_post_validate_submission', 'my_email_thankyou' );
132+
function my_email_thankyou( $return ) {
133+
// do nothing if form validation failed
134+
if ( ! $return->ok ) {
135+
return;
136+
}
137+
138+
$name = sanitize_text_field( $_POST['name'] );
139+
$email = sanitize_email( $_POST['email'] );
140+
$to = "\"$name\" <$email>";
141+
$subject = __( 'Thank You For Submitting A Form' );
142+
$content = wp_sprintf( __('Thanks, %s for clicking Submit on this glorious HTML5 Form!'), $name );
143+
wp_mail( $to, $subject, $content );
144+
}
145+
```
146+
147147
## Javascript API
148148

149149
### Client side callbacks
@@ -195,4 +195,3 @@ The attribute will render as is on the `<form>` element
195195
```html
196196
<form class="libre-form libre-form-1" data-custom-attr="contactme">
197197
```
198-

0 commit comments

Comments
 (0)