|
/ Documentation /Developer Hooks & Events/ suredonation_show_setup_gateway_notice Filter Hook

suredonation_show_setup_gateway_notice Filter Hook

Overview

The suredonation_show_setup_gateway_notice filter controls whether the Set Up a Payment Gateway admin notice is displayed in SureDonation when no payment gateway is connected.

By default, the notice is enabled. Developers can use this filter to suppress the notice when it is not required for a specific website, workflow, or custom admin experience.

Returning false suppresses both the notice and its associated stylesheet.

When to Use This Filter

Use this filter when you need to control the visibility of the payment gateway setup notice.

For example, you can use it to:

  • Hide the setup notice from administrators.
  • Suppress the notice on custom installations.
  • Control the notice through custom plugin logic.
  • Prevent the notice stylesheet from being loaded when the notice is disabled.

Filter Signature

apply_filters( 'suredonation_show_setup_gateway_notice', true );

Parameters

ParameterTypeDescription
$valueboolDetermines whether the setup gateway notice should be displayed.

Default Value

The default value is: true

This means the setup gateway notice is enabled by default.

Return Value

Return a boolean value:

Return ValueResult
trueAllows the setup gateway notice to be displayed.
falseSuppresses the setup gateway notice and its stylesheet.

Basic Usage

Use add_filter() to register a custom callback.

add_filter( 'suredonation_show_setup_gateway_notice', 'your_custom_function', 10, 1);

function your_custom_function( $show ) {

    return $show;

}

Example: Disable the Setup Gateway Notice

The following example permanently hides the setup gateway notice.

// Never show the setup gateway notice.

add_filter( 'suredonation_show_setup_gateway_notice',  '__return_false');

Example: Conditionally Hide the Notice

You can also use custom logic to determine whether the notice should be displayed.

add_filter( 'suredonation_show_setup_gateway_notice', 'mysite_hide_gateway_notice', 10, 1);

function mysite_hide_gateway_notice( $show ) {
    if ( current_user_can( 'manage_options' ) ) {
        return false;
    }
    return $show;
}

How It Works

The filter is used in two locations within the Notices class:

  1. Notice registration
    • Controls whether the setup gateway notice is registered and displayed.
  2. Stylesheet loading
    • Controls whether the stylesheet required by the notice is enqueued.

Both locations use the same filter. Therefore, returning false consistently prevents both the notice and its stylesheet from being loaded.

Additional Display Conditions

The filter controls whether the notice is allowed to appear, but SureDonation also checks additional conditions before displaying it.

The setup gateway notice is displayed only when:

  • There are no live donations.
  • No payment gateway is configured.
  • The filter allows the notice to be displayed.

Therefore, returning true does not force the notice to appear if the other display conditions are not met.

Related Hooks

  • suredonation_show_review_notice_donation
  • suredonation_show_review_notice_gateway
Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
Table of Contents
Scroll to Top