Give 1.8.14 – Introducing the new Give_Donors_Query class

In Give version 1.8.14, We are introducing the new Give_Donors_Query class which will help developers to query donors more easily and efficiently with less code. [Read]

Here is a general code sample query parameters for Give_Donors_Query:

$donor = new Give_Donors_Query(array(
    'number'     => 20,
    'offset'     => 0,
    'paged'      => 1,
    'orderby'    => 'id',
    'order'      => 'DESC',
    'user'       => null,   // Single or array of user ids
    'email'      => null,   // Single or comma seperated emails
    'donor'      => null,   // Single or array of donor ids
    'meta_query' => array(),
    'date_query' => array(),
    's'          => null,   // search string with prefix name: or note:
    'fields'     => 'all', // Support donors (all fields) or valid column  as string or array
    'count'      => false, // Set to true to get donor count for current query

Another demo query for the Give_Donors_Query class:

1. Get donors and sort by total donation amount:

$donors = new Give_Donors_Query(array(
    'number'     => -1,
    'orderby'    => 'purchase_value',
$donors = $donors->get_donors();

2. Get donors and sort by total donation count:

$donors = new Give_Donors_Query(array(
    'number'     => -1,
    'orderby'    => 'purchase_count',
$donors = $donors->get_donors();

3. Get information about specific donors:

$donors = new Give_Donors_Query(array(
    'donor'    => array( 11, 45, 67 ),
$donors = $donors->get_donors();

4. Get the total number of donors:

$donors = new Give_Donors_Query(array(
    'number' => -1,
    'count' => true,
$donors = $donors->get_donors();

This class was created because we found it difficult and cumbersome to do more complex donor queries. We will continue to optimize the class as we move forward. Please let us know if you find any issues on GitHub.


Give 1.8.14 – Give_Notices Class Update

In Give version 1.8.9 we introduced the Notices API. In release 1.8.14 we are adding improvements to the API so that you can create non-dismissible notice without a close icon appearing [Read]. This type of notice should only be used for very important messages, like blockers, such as database updates and missing dependancies.

Here is a general code example to create a notice with the Give_Notices API:

    'id' => '' // Value: unique notice id
    'type' => '' // Value: error/warning/success/info/updated
    'description' => '' // Value: notice message content
    'dismissible' => '' // Value: auto/true/false. if set to true then notice will auto class in 5 seconds
    'dismissible_type' => '' // Value: null/user/all
    'dismiss_interval' => '' // Value shortly/permanent/custom
    'dismiss_interval_time' => '' // Value: time interval in seconds (only need if dismiss_interval set to custom)


If you want to create non-dismissible notice without close icon set dismissible to false.

Non dismissible notices without close icon

In addition to the new non-dismissible notice enhancement we have deprecated the auto-dismissible parameter for simply dismissible with backward compatibility.

We’re also working to create inline notices and other additional notice enhancements in the future so stay tuned!


Give 1.8.13 Tab Improvements & Conditional Field Changes

Give 1.8.13 introduces subtle improvements to the tabbed interface when editing a donation form. The improvements are summarized below along with a new requirement that developers should be aware in order to produce a seamless tabbed experience.

Added Unique Tab URLs

Each tab now has a unique URL denoted by a give-tab query parameter that updates on each tab change. This means that tabs can be navigated to directly, bookmarked, and most importantly, maintained after a page reload. For example, the URL of the Form Display tab would be structured as follows:

Added Active Tab Persistence

Because each tab now has a unique URL, the active tab can be maintained after save. For example, if the active tab is Form Display when the form is published or updated, then the page will reload with Form Display as the active tab. The result is a more seamless experience, especially for users who save and refresh the screen often during the initial form build.

Tab detection is made possible by a $_GET['give-tab'] parameter that is detected server-side and included in the redirect after save.

Removed Conditional Fields Flicker

In previous versions of Give, conditional fields that should be hidden by default would flicker upon page load. This flicker occurred because conditional fields were being hidden via JavaScript after page load. As of Give 1.8.13, a give-hidden class is applied to conditional fields via PHP so that they are hidden by default, thus preventing any chance of flicker.

Developers Note This Important Change to Conditional Fields

When registering conditional settings in the future, developers should ensure that the 'wrapper_class' => 'give-hidden' is used in order to hide the conditional field by default. An example use case is provided below.

 * Below are two field settings. If Custom Amount is enabled, then Minimum
 * Amount becomes visible. Note the use of 'wrapper_class' in the
 * conditional field to ensure Minimum Amount is hidden by default.

// Regular field.
    'name'        => __( 'Custom Amount', 'give' ),
    'description' => __( '...', 'give' ),
    'id'          => $prefix . 'custom_amount',
    'type'        => 'radio_inline',
    'default'     => 'disabled',
    'options'     => array(
        'enabled'  => __( 'Enabled', 'give' ),
        'disabled' => __( 'Disabled', 'give' ),

// Conditional field.
    'name'          => __( 'Minimum Amount', 'give' ),
    'description'   => __( '...', 'give' ),
    'id'            => $prefix . 'custom_amount_minimum',
    'type'          => 'text_small',
    'data_type'     => 'price',
    'attributes'    => array(
        'placeholder' => $price_placeholder,
        'value'       => $custom_amount_minimum,
        'class'       => 'give-money-field',
    'wrapper_class' => 'give-hidden', // Note the use of 'wrapper_class'.