Skip to content

Instantly share code, notes, and snippets.

@landbryo
Created August 11, 2020 19:19
Show Gist options
  • Save landbryo/0299f7238f5f7c218fe0653cbafdaa9b to your computer and use it in GitHub Desktop.
Save landbryo/0299f7238f5f7c218fe0653cbafdaa9b to your computer and use it in GitHub Desktop.
BuddyPress Group Email Subscriptions email filters.
<?php
/**
*
* @param string $footer
* @param string $type Digest type. 'sum' or 'dig'.
*/
add_filter( 'ass_digest_footer', function ( $footer, $type ) {
return $footer;
} );
add_filter( 'ass_digest_group_activity_ids', function ( $activity_ids ) {
return $activity_ids;
} );
add_filter( 'ass_digest_subject', function ( $subject, $blogname, $title, $type ) {
return $subject;
} );
add_filter( 'ass_digest_header', function ( $header, $title, $title_css ) {
return $header;
} );
/**
* Update email CSS
*
* @param array $css
*/
add_filter( 'ass_email_css', function ( $css ) {
return $css;
} );
add_filter( 'ass_digest_title', function ( $title, $type ) {
return $title;
} );
add_filter( 'bp_ges_activity_is_valid_for_digest', function ( $is_valid, $activity_id, $digest_type, $user_id ) {
return $is_valid;
}, 10, 4 );
add_filter( 'bp_ges_login_redirect_url', function ( $login_redirect_url ) {
return $login_redirect_url;
} );
add_filter( 'ass_login_url', function ( $login_url ) {
return $login_url;
} );
add_filter( 'ass_login_redirect_to', function ( $url, $context ) {
return urlencode( $url );
}, 10, 2 );
add_filter( 'ass_digest_summary', function ( $summary, $count, $summary_css, $group_slug, $group_name, $activity_ids ) {
return $summary;
}, 10, 6 );
add_filter( 'ass_digest_group_message_title', function ( $group_message, $group_id, $type ) {
return $group_message;
}, 10, 3 );
add_filter( 'ass_digest_format_item_group', function ( $group_message, $group_id, $type, $activity_ids, $user_id ) {
return $group_message;
}, 10, 5 );
add_filter( 'ass_digest_content', function ( $content, $item, $type ) {
return $content;
}, 10, 3 );
add_filter( 'ass_digest_format_item', function ( $item_message, $item, $action, $timestamp, $type, $replies ) {
return $item_message;
}, 10, 6 );
add_filter( 'ass_digest_message_html', function ( $html, $message ) {
return $html;
}, 10, 2 );
add_filter( 'ass_digest_record_activity_allow', function ( $allow, $activity_id, $user_id, $group_id, $type ) {
return $allow;
}, 10, 5 );
add_filter( 'bp_ges_stale_activity_period', function ( $default_stale_activity_period, $activity_id, $digest_type, $user_id ) {
return $default_stale_activity_period;
}, 10, 4 );
add_filter( 'bpges_user_digest_items', function ( $items, $user_id, $type, $timestamp, $is_preview ) {
return $items;
}, 10, 5 );
add_filter( 'ass_digest_summary_full', function ( $summary_full, $summary_ul_css, $summary ) {
return $summary_full;
}, 10, 3 );
add_filter( 'ass_summary_follow_topic', function ( $summary_follow_topic, $follow_topic_css ) {
return $summary_follow_topic;
}, 10, 2 );
add_filter( 'ass_digest_disable_notifications', function ( $unsubscribe_message, $userdomain_group_slug ) {
return $unsubscribe_message;
}, 10, 2 );
/**
* For plugins to stop emails from being sent
*/
add_filter( 'bp_ges_send_digest_to_user', function ( $send, $user_id, $group_activity_ids, $message ) {
return $send;
}, 10, 4 );
/**
* Filters the arguments passed to `ass_send_email()` when a digest is sent.
*
* @param array $user_message_args Arguments passed to ass_send_email 'tokens' param.
* @param int $user_id ID of the user whose digest is currently being processed.
* @param array $group_activity_ids_pristine Array of activity items in the digest.
*
* @since 3.7.3
*
*/
add_filter( 'bp_ges_user_digest_message_args', function ( $user_message_args, $user_id, $group_activity_ids_pristine ) {
return $user_message_args;
}, 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment