This post was written 3 years ago and therefore may not be as accurate as more recent posts.

A few lines of code that you can add to your plugin to get it to email you when someone activates it.

[php]register_activation_hook(__FILE__, ‘tracking’);

function tracking()
{

$to = "[email protected]";

$subject = ‘Install of [Plugin Name] from ‘.$_SERVER[‘SERVER_NAME’];

$message = ‘
<html>
<head>
<title>’.$subject.'</title>
</head>
<body>
<h1>’.$subject.'</h1>
</body>
</html>
‘;

$headers = ‘MIME-Version: 1.0′ . "\r\n";
$headers .= ‘Content-type: text/html; charset=iso-8859-1′ . "\r\n";

$headers .= ‘From: No Reply <[email protected]>’ . "\r\n";

mail($to, $subject, $message, $headers);
}[/php]

Categories: WordPress Plugins

Shane Jones

Posted by

Shane is the Co-Founder of Peadig, the WordPress framework and has gained over 40,000 downloads of his WordPress plugins. Shane also likes to tinker with API's and specialises in Facebook, Twitter, Instagram and Foursquare API. The views expressed in Shane's posts are his own and are not necessarily the views of his employers.

Comments