Ping on Membership- small fix needed

Hi, this thread https://premium.wpmudev.org/forums/topic/pings-on-membership-1#post-243844 has been going on for a couple of weeks and is just sitting there so here is the update on my progress and what still needs to be fixed…

Site set up:

membership plugin site by site install on a multisite set up.

Goal

I am trying to send a message to the subsite admin when a user changes his membership level. I am trying to do this through a joining ping.

I am also trying to send the blog user whose membership level is changed an email message.

VeBailovity gave me this code in chat today, it uses the post method. (noreply@mysite.com is replaced with my site email address)

<?php

//Hook up to WordPress

require(‘./wp-load.php’:wink:;

$current_user = wp_get_current_user();

$admin_email = get_bloginfo(‘admin_email’:wink:;

$user_email = $current_user->user_email;

$to = $user_email . ‘,’ . $admin_email;

$subject = ‘Membership Message’;

$headers = “From: noreply@mysite.comrn“;

$headers .= ‘MIME-Version: 1.0’ . “rn”;

$headers .= ‘Content-type: text/html; charset=iso-8859-1’ . “rn”;

$message = “Blog url: “.$_POST.”

Username: “.$_POST.”

Subscription: “.$_POST.”

Membership Level: “.$_POST.”

” ;

mail($to, $subject, $message, $headers);

?>

The from address works but the super admin, not the blog user or the subsite admin receives the message. I tried this logged in as the blog user and also logged in as the subsite admin. Both times only the super admin gets the message.

How do I send the emails to the relevant subsite admin and blog user?