fromid; $comment = $commentsJson[0]->text; fbComments_log(" Fetching user info using an access token of {$fbc_options['accessToken']}"); $user = fbComments_getUrl("https://api.facebook.com/method/users.getInfo?uids=$userId&fields=name&access_token={$fbc_options['accessToken']}&format=json"); $userJson = json_decode($user); $username = $userJson[0]->name; fbComments_log(" For latest comment, poster UID=$userId, poster name=$username, comment=$comment"); $to = get_bloginfo('admin_email'); $subject = "[Facebook Comments for WordPress] New comment: \"{$_POST['postTitle']}\""; $message = "$username has posted a new comment on your post \"{$_POST['postTitle']}\":\n\n" . "$comment\n\n" . "You can see all Facebook comments on this post here: {$_POST['postUrl']}#facebook-comments"; // Wordwrap the message and strip slashes that may have wrapped quotes $message = stripslashes(wordwrap($message, 70)); $headers = "From: $username <$to>\r\n" . "Reply-To: $to\r\n" . "X-Mailer: PHP" . phpversion(); // Send the email notification if (wp_mail($to, $subject, $message, $headers)) { fbComments_log(sprintf(' Sent email notification to %s', $to)); echo "true"; } else { fbComments_log(sprintf(' FAILED to send email notification to %s', $to)); echo "false"; } exit(); break; } ?>