WPMU DEV Free Notices module
WPMU DEV Free Notices module (short wpmu-free-notice) is used in our free plugins hosted on WordPress.org It will display a welcome message upon plugin activation that offers the user a 5-day introduction email course for the plugin. After 7 days the module will display another message asking the user to rate the plugin on WordPress.org
How to use it
Insert this repository as sub-module into the existing project
Include the file
module.phpin your main plugin file.Call the action
wdev_register_pluginwith the params mentioned below.Done!
Upgrading from 1.3.0 version
The 2.0.0 release is backward incompatible with the 1.x versions. To accommodate new functionality and fix WordPress coding standards violations, a lot of the hooks/filters have been refactored. Make sure to change the following:
- Update the
do_actionhook name fromwdev-register-plugintowdev_register_plugin. - Both
wdev-email-message-andwdev-rating-message-filters have been changed towdev_email_title_/wdev_email_message_andwdev_rating_title_/wdev_rating_message_
Code Example (from Smush )
#!php
<?php
// Load the WPMU_Free_Notice module.
include_once 'lib/wdev-frash/module.php';
// Register the current plugin.
do_action(
'wdev_register_plugin',
/* 1 Plugin ID */ plugin_basename( __FILE__ ),
/* 2 Plugin Title */ 'Smush',
/* 3 https://wordpress.org */ '/plugins/wp-smushit/',
/* 4 Email Button CTA */ __( 'Get Fast!', MYD_TEXT_DOMAIN ),
/* 5 Mailchimp List id for the plugin - e.g. 4b14b58816 is list id for Smush */ '4b14b58816'
);
// All done!
- Always same, do not change
- The plugin title, same as in the plugin header (no translation!)
- The WordPress.org plugin-URL
- Optional: Title of the Email-subscription button. If empty no email message is displayed.
- Optional: Mailchimp List id for the plugin. If empty no email message is displayed
Optional: Customize the messages via filters
<?php
// The email message contains 1 variable: plugin-name
add_filter(
'wdev_email_message_' . plugin_basename( __FILE__ ),
'custom_email_message'
);
function custom_email_message( $message ) {
$message = 'You installed %s! This is a custom <u>email message</u>';
return $message;
}
<?php
// The rating message contains 2 variables: user-name, plugin-name
add_filter(
'wdev_rating_message_' . plugin_basename( __FILE__ ),
'custom_rating_message'
);
function custom_rating_message( $message ) {
$message = 'Hi %s, you used %s for a while now! This is a custom <u>rating message</u>';
return $message;
}