I’m having trouble customizing a donation form.
I need to add two fields to it.
One to register for a donor’s birthday.
And a second one to register the ID number of the donor.
Before proceeding with the donation, both fields have to be checked to verify that the donor is over 18. Some numbers in the ID value must match the month and year of the birthday value.
So far, I have created 2 custom fields : date and text :
add_action('givewp_donation_form_schema', static function (Give\Framework\FieldsAPI\DonationForm $form) {
// birthday
$field_date = Give\Framework\FieldsAPI\Date::make('birthday')
->showInReceipt()
->label('Birthday')
->placeholder('01/01/1970') // placeholder not working on date field by the way
->dateFormat('dd/mm/yyyy')
->required()
// ->rules()
->showInAdmin();
// id
$field_id_num = Give\Framework\FieldsAPI\Text::make('id_num')
->showInReceipt()
->label('ID Number')
->placeholder('95052125896')
->required()
->maxLength(11)
->minLength(11)
->showInAdmin();
$form->insertBefore('donationAmount', $field_date);
$form->insertAfter('birthday', $field_id_num);
});
I’m currently stuck to limit birthday selection to years overs 18 and to check the values.
reactdatepicker, used in the date field, is able to exclude date intervals:
https://reactdatepicker.com/#example-exclude-date-intervals
How could I “override” the default configuration to achieve this?
It seems that Give has tools to validate rules (->rules() / HasValidationRules), but I can’t find resources to make it work.
I also tried to load a custom javascript to the form to check values this way, but I only managed to load it on the confirmation step.
Could you, please, describe how to use the validation rules and/or to enqueue a custom script on the form?
Kind regards.
Gér?me
I would like to set a 10% percentage discount for all products.
In the Pricing tab, I selected “Percentage discount” as the Pricing type and set “Discount (%)” to 10.
Additionally, I want this rule to apply only to Customers, so in the User & Roles section, I included the Customer role under “Include user roles”.
However, after saving the rule, only the user role setting remains, while the price-related inputs are not filled.
Are there any additional fields I need to complete to ensure the discount is saved correctly?
Thank you!
]]>Wordfence is showing the error: “Last rules update for the Wordfence Web Application Firewall was unsuccessful.” The issue seems to be that my IPv6-only server running Wordfence tries to connect to noc1.wordfence.com, which is IPv4-only, and my server cannot reach it.
The diagnostics page in Wordfence Tools shows an error in “wp_remote_post() test to noc1.wordfence.com failed! Response was: cURL error 7: Failed to connect to noc1.wordfence.com port 443 after 2 ms: Couldn't connect to serve
“. Connecting back to this site and connecting back to this site via IPv6 work since they go through Cloudflare.
Would it be possible to provide IPv6 access for Wordfence rules updates?
dig noc1.wordfence.com
; <<>> DiG 9.18.30-0ubuntu0.24.04.2-Ubuntu <<>> noc1.wordfence.com
...
;; QUESTION SECTION:
;noc1.wordfence.com. IN A
;; ANSWER SECTION:
noc1.wordfence.com. 24 IN A 54.148.171.133
noc1.wordfence.com. 24 IN A 52.25.185.95
noc1.wordfence.com. 24 IN A 35.83.41.128
...
]]>How can I enter more rules ?
It looks like more of a problem related to the entry screen.
Have disabled caching, I believe.
]]>I did choose only to show button for mobile and tablet – this works fine!
But when applying rule to onyl show if single page is: https://aqstik.dk/akustikbilleder/ – this is not working?
Can i somehow only choose to show button i my shop?
Please fix these rules so that we can prevent an email and IP from placing multiple orders with our settings.
]]>Using the advanced options, I was able to remove the query string blocking and resolve it that way, however, that disables all checks on the query string rather than the specific check on some special characters I needed to remove.
Since the particular rules are implemented in php, modifying them isn’t that easy. Especially considering the current implementation, modifications would probably have to be very intrusive. I’m not sure if it’s even possible without changing the plugin’s code, which is not preferable.
I found no relevant hooks, so if in the future more hooks can be added that allow for more fine-tuned control of the plugin’s rules, that would be very useful. Some possibilities would be hooks that allow you to filter the patterns used by rules, or hooks that allow you to filter the rules themselves.
]]>Any idea why this is happening? I tried multiplying price etc and that works but modifying existing fields just doesn’t seem to work.
]]>“The last rules update for the Wordfence Web Application Firewall was unsuccessful. The last successful update check was Dec 18, 2023 12:07, so this site may be missing new rules added since then. You may wait for the next automatic attempt at Sep 19, 2024 22:24 or try to?Manually Update?by clicking the “Manually Refresh Rules” button below the Rules list.”
In “Diagnostics” the only information that appears in red is this:
“Connecting back to this site via IPv6 (not required; failure to connect may not be an issue on some sites)
This diagnostic requires cURL”