Skip to content

Disable forum post update emails for non-members #45

@ipokkel

Description

@ipokkel

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions