rcp_reminder_notice_periods

Note: This is part of the developer docs and is considered custom code.
Unfortunately, we cannot provide support for custom code at this time as we do not have the additional resources that would be necessary to provide support for custom code.

If you need assistance with this, please reach out to our list of consultants for further assistance:
https://codeable.io/developers/restrict-content-pro/

Filters the available expiration/renewal reminder periods (such as "1 month before", "2 days before", etc.).

Parameters:

  • $periods (array) - Array of available periods. The key is in a time format that can be parsed by PHP, such as "+2days" for "Two days before", or "-1week" for "One week after". The value is the label.

To get a sense of proper formatting, here's the array and filter in context:

$periods = array(
	'today'    => __( 'The day of the renewal/expiration', 'rcp' ),
	'+1day'    => __( 'One day before renewal/expiration', 'rcp' ),
	'+2days'   => __( 'Two days before renewal/expiration', 'rcp' ),
	'+3days'   => __( 'Three days before renewal/expiration', 'rcp' ),
	'+4days'   => __( 'Four days before renewal/expiration', 'rcp' ),
	'+5days'   => __( 'Five days before renewal/expiration', 'rcp' ),
	'+6days'   => __( 'Six days before renewal/expiration', 'rcp' ),
	'+1week'   => __( 'One week before renewal/expiration', 'rcp' ),
	'+2weeks'  => __( 'Two weeks before renewal/expiration', 'rcp' ),
	'+3weeks'  => __( 'Three weeks before renewal/expiration', 'rcp' ),
	'+1month'  => __( 'One month before renewal/expiration', 'rcp' ),
	'+2months' => __( 'Two months before renewal/expiration', 'rcp' ),
	'+3months' => __( 'Three months before renewal/expiration', 'rcp' ),
	'-1day'    => __( 'One day after expiration', 'rcp' ),
	'-2days'   => __( 'Two days after expiration', 'rcp' ),
	'-3days'   => __( 'Three days after expiration', 'rcp' ),
	'-1week'   => __( 'One week after expiration', 'rcp' ),
	'-2weeks'  => __( 'Two weeks after expiration', 'rcp' ),
	'-1month'  => __( 'One month after expiration', 'rcp' ),
	'-2months' => __( 'Two months after expiration', 'rcp' ),
	'-3months' => __( 'Three months after expiration', 'rcp' )
);

/**
 * Filters the available notice periods.
 *
 * @param array $periods
 *
 * @since 2.9.8
 */
return apply_filters( 'rcp_reminder_notice_periods', $periods );

Example:

Here's an example for adding an extra period for four days after expiration:

function ag_rcp_reminder_four_days_after( $periods ) {
	$periods['-4days'] = __( 'Four days after expiration', 'rcp' );
	
	return $periods;
}
add_filter( 'rcp_reminder_notice_periods', 'ag_rcp_reminder_four_days_after' );
Powered by Zendesk