Filter
uncanny-automator
automator_facebook_group_token_notice_n_days
Filters the number of days before a Facebook group token expiration notice appears, defaulting to 14 days.
add_filter( 'automator_facebook_group_token_notice_n_days', $callback, 10, 1 );
Description
Filters the number of days before the Facebook Group token expiration notice is displayed. Developers can use this to customize the reminder period for Facebook Group integration token validity within the Uncanny Automator plugin.
Usage
add_filter( 'automator_facebook_group_token_notice_n_days', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
// Set the notice duration to 30 days for Facebook Group token expiration warnings.
add_filter( 'automator_facebook_group_token_notice_n_days', 'my_custom_facebook_group_token_notice_days', 10, 1 );
function my_custom_facebook_group_token_notice_days( $default_days ) {
// The default value is 14 days. We are changing it to 30 days.
$custom_days = 30;
// You could add logic here to dynamically set the days based on user role or other conditions.
// For example:
// if ( current_user_can( 'administrator' ) ) {
// $custom_days = 60;
// }
return $custom_days;
}
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/integrations/facebook-groups/helpers/facebook-groups-helpers.php:132
public function maybe_add_admin_notice() {
$n_days = $this->get_token_days_remaining( $this->get_token_info() );
$fb_groups_integration = Automator()->get_integration( 'FACEBOOK_GROUPS' );
if ( isset( $fb_groups_integration['connected'] ) && false === $fb_groups_integration['connected'] ) {
return;
}
$token_notice_n_days = apply_filters( 'automator_facebook_group_token_notice_n_days', 14 );
if ( $n_days <= $token_notice_n_days && $this->has_live_integration() ) {
add_action( 'automator_show_internal_admin_notice', array( $this, 'admin_notice_template' ) );
}
}