Membership activation email is sent to admins

Hello! When activating a new membership, the activation email isn’t going to the user for which the membership is being activated for. It is going to my admin email box. How can I fix this??

Please let me know if this issue occurs only if memberships are added manually via the back-end, or also when memberships are selected/purchased via the front-end by users?

Only when added manually on the backend, I do not have the option to select it on the front end because I verify requests manually for the membership.

Thanks, if this issue occurs when adding memberships manually only then it’s confirmed, we’ll fix it in the next Memberships update.

Thank you!

Hello! Is there any update on this?? The membership emails are still being sent to my admin email instead of the clients email when I add the memberships manually.

Please send temporary WP access to support@hivepress.io and we’ll make a temporary fix before the official Memberships release (usually we wait for a few more fixes/improvements before releasing an update). You can create a temporary access link using this plugin Temporary Login Without Password – WordPress plugin | WordPress.org

Temporary access made

Please try this PHP snippet as a temporary solution

if(hivepress()->get_version('memberships')){
	remove_action('hivepress/v1/models/membership/update_status', [hivepress()->memberhsip, 'update_membership_status'], 10, 2);
add_action( 
	'wp_after_insert_post', 
	function ( $post_id, $post, $update, $post_before ) {
		if ( 'hp_membership' !== $post->post_type || 'publish' !== $post->post_status || ( isset( $post_before ) && $post_before->post_status === $post->post_status ) ) {
			return;
		}

		// Get membership.
		$membership = \HivePress\Models\Membership::query()->get_by_id( $post_id );

		if ( ! $membership ) {
			return;
		}

		// Send email.
		$user = $membership->get_user();

		if ( $user ) {
			( new \HivePress\Emails\Membership_Activate(
				[
					'recipient' => $user->get_email(),

					'tokens'    => [
						'user'            => $user,
						'membership'      => $membership,
						'user_name'       => $user->get_display_name(),
						'membership_plan' => $membership->get_name(),
						'memberships_url' => hivepress()->router->get_url( 'memberships_view_page' ),
					],
				]
			) )->send();
		}

	}, 
	10, 
	4 
);	
}

That worked! Thank you

1 Like