README.md
72 lines
| 1 | # WDEV Frash module # |
| 2 | |
| 3 | WPMU DEV Free Dashboard module (short wdev-frash) is used in our free plugins hosted on wordpress.org |
| 4 | 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 |
| 5 | |
| 6 | # How to use it # |
| 7 | |
| 8 | 1. Insert this repository as **sub-module** into the existing project |
| 9 | |
| 10 | 2. Include the file `module.php` in your main plugin file. |
| 11 | |
| 12 | 3. Call the action `wdev-register-plugin` with the params mentioned below. |
| 13 | |
| 14 | 4. Done! |
| 15 | |
| 16 | |
| 17 | ## Code Example (from Smush ) ## |
| 18 | |
| 19 | ``` |
| 20 | #!php |
| 21 | |
| 22 | <?php |
| 23 | // Load the WDev-Frash module. |
| 24 | include_once 'lib/wdev-frash/module.php'; |
| 25 | |
| 26 | // Register the current plugin. |
| 27 | do_action( |
| 28 | 'wdev-register-plugin', |
| 29 | /* 1 Plugin ID */ plugin_basename( __FILE__ ), |
| 30 | /* 2 Plugin Title */ 'Smush', |
| 31 | /* 3 https://wordpress.org */ '/plugins/wp-smushit/', |
| 32 | /* 4 Email Button CTA */ __( 'Get Fast!', MYD_TEXT_DOMAIN ), |
| 33 | /* 5 Mailchimp List id for the plugin - e.g. 4b14b58816 is list id for Smush */ '4b14b58816' |
| 34 | ); |
| 35 | // All done! |
| 36 | ``` |
| 37 | |
| 38 | 1. Always same, do not change |
| 39 | 2. The plugin title, same as in the plugin header (no translation!) |
| 40 | 3. The wordpress.org plugin-URL |
| 41 | 4. Optional: Title of the Email-subscription button. If empty no email message is displayed. |
| 42 | 5. Optional: Mailchimp List id for the plugin. If empty no email message is displayed |
| 43 | |
| 44 | |
| 45 | ## Optional: Customize the messages via filters ## |
| 46 | |
| 47 | ``` |
| 48 | <?php |
| 49 | // The email message contains 1 variable: plugin-name |
| 50 | add_filter( |
| 51 | 'wdev-email-message-' . plugin_basename( __FILE__ ), |
| 52 | 'custom_email_message' |
| 53 | ); |
| 54 | function custom_email_message( $message ) { |
| 55 | $message = 'You installed %s! This is a custom <u>email message</u>'; |
| 56 | return $message; |
| 57 | } |
| 58 | ``` |
| 59 | |
| 60 | ``` |
| 61 | <?php |
| 62 | // The rating message contains 2 variables: user-name, plugin-name |
| 63 | add_filter( |
| 64 | 'wdev-rating-message-' . plugin_basename( __FILE__ ), |
| 65 | 'custom_rating_message' |
| 66 | ); |
| 67 | function custom_rating_message( $message ) { |
| 68 | $message = 'Hi %s, you used %s for a while now! This is a custom <u>rating message</u>'; |
| 69 | return $message; |
| 70 | } |
| 71 | ``` |
| 72 |