Ping on Membership- small fix needed

Hi, this thread 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.

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. ( is replaced with my site email address)

//Hook up to Wordpress

$current_user = wp_get_current_user();
$admin_email = get_bloginfo('admin_email');
$user_email = $current_user->user_email;

$to = $user_email . ',' . $admin_email;
$subject = 'Membership Message';
$headers = "From:\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$message = "Blog url: ".$_POST['blogurl']."
Username: ".$_POST['username']."
Subscription: ".$_POST['subscription']."
Membership Level: ".$_POST['level']."
" ;
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?

  • aecnu

    Greetings Atlanta,

    Thank you for this great question and a significant item to bring up.

    I have no idea what the answer is to this undocumented and still being developed feature of the Membership plugin.

    Therefore I will see if I can get the lead developer in here with his invaluable insight into this plugin and feature for his advice/advise for us.

    Though this may take a bit longer then a normal ticket, I will try to get him in here asap.

    Cheers, Joe

  • Atlanta

    Closing this ticket.
    Arnold did a great job of figuring out what was going wrong:slight_smile:
    Here is the solution in case anybody else runs in to the same problem.

    1. In my ping set up under remote pings I incorrectly had the following pasted as ping data:


    It should have been:


    2. pingtest.php
    this code sends an email to the admin and the user who requested a change in subscription plan. Important to note that the admin email is coming from the settings page, not the user profile page. My site has registration disabled so it kind of wrecks havoc on changing the email address in settings, so I don't get the email confirmation messages (that will be a different ticket) so I have to change the email address through the database (temporary solution)

    //Hook up to Wordpress

    //$admin_email = get_bloginfo('admin_email');
    $blogid = get_blog_details($_POST['blogname']);
    $blogid = $blogid->blog_id;

    $admin_email = get_blog_option($blogid, 'admin_email' );

    //$to = $_POST['useremail'] . ',' . $admin_email .';

    $to = $_POST['useremail'] . ',' . $admin_email;
    $subject = 'Message For You';
    $headers = "From:\r\n";
    $headers .= 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    $message = "Blog url: ".$_POST['blogurl']."
    Username: ".$_POST['username']."
    Subscription: ".$_POST['subscriptionname']."
    Membership Level: ".$_POST['levelname']."
    " ;
    mail($to, $subject, $message, $headers);

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.