Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable forum post update emails for non-members #45

Open
ipokkel opened this issue Jun 19, 2023 · 0 comments
Open

Disable forum post update emails for non-members #45

ipokkel opened this issue Jun 19, 2023 · 0 comments

Comments

@ipokkel
Copy link
Member

ipokkel commented Jun 19, 2023

Is your feature request related to a problem? Please describe.
Non-members and users without a bbPress forum role, e.g. spectator role, receive forum update emails for topics they've subscribed to previously.

Describe the solution you'd like
Non-members and users without a spectator role should not get forum emails for subscribed topics.

Describe alternatives you've considered
The user that requested this feature reported tweaking code from the bbPress Toolkit that seems abandoned as there has not been an update for this in the past 5 years.

Here's the example shared by them:

// Spectator users should NOT get an email to subscribed topics
// Waiting for https://bbpress.trac.wordpress.org/ticket/3046
function bbptoolkit_fltr_get_forum_subscribers( $user_ids ) {
	if ( ! empty( $user_ids ) ) {
		$new_user_ids = array();
		foreach ( $user_ids as $uid ) {
			if ( bbp_get_user_role( $uid ) != ‘bbp_spectator’ ) {
				$new_user_ids[] = $uid;
			}
		}
		return $new_user_ids;
	} else {
		return $user_ids;
	}
};
// add the filter
add_filter( ‘bbp_forum_subscription_user_ids’, ‘bbptoolkit_fltr_get_forum_subscribers’, 10, 1 );

Additional context
Moderators: #502396

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant