Support Email Module to be included in our Premium Plugins
Using this submodule is super easy! Just follow the following steps and you'll be all set.
git submodule add https://github.com/realbigplugins/rbp-support.git ./whatever/path/you/want
git submodule update --init --recursive
require_once __DIR__ . '/whatever/path/you/want/rbp-support.php';
$this->support = new RBP_Support( <PATH_TO_PLUGIN_FILE>, <LICENSE_ACTIVATION_URI>, array(
'support_form' => array(
'enabled' => array(
'title' => _x( 'Need some help with %s?', '%s is the Plugin Name', <PLUGIN_TEXT_DOMAIN> ),
'subject_label' => __( 'Subject', <PLUGIN_TEXT_DOMAIN> ),
'message_label' => __( 'Message', <PLUGIN_TEXT_DOMAIN> ),
'send_button' => __( 'Send', <PLUGIN_TEXT_DOMAIN> ),
'subscribe_text' => _x( 'We make other cool plugins and share updates and special offers to anyone who %ssubscribes here%s.', 'Both %s are used to place HTML for the <a> in the message', <PLUGIN_TEXT_DOMAIN> ),
'validationError' => _x( 'This field is required', 'Only used by legacy browsers for JavaScript Form Validation', <PLUGIN_TEXT_DOMAIN> ),
'success' => __( 'Support message succesfully sent!', <PLUGIN_TEXT_DOMAIN> ),
'error' => __( 'Could not send support message.', <PLUGIN_TEXT_DOMAIN> ),
),
'disabled' => array(
'title' => _x( 'Need some help with %s?', '%s is the Plugin Name', <PLUGIN_TEXT_DOMAIN> ),
'disabled_message' => __( 'Premium support is disabled. Please register your product and activate your license for this website to enable.', <PLUGIN_TEXT_DOMAIN> )
),
),
'licensing_fields' => array(
'title' => _x( '%s License', '%s is the Plugin Name', <PLUGIN_TEXT_DOMAIN> ),
'deactivate_button' => __( 'Deactivate', <PLUGIN_TEXT_DOMAIN> ),
'activate_button' => __( 'Activate', <PLUGIN_TEXT_DOMAIN> ),
'delete_deactivate_button' => __( 'Delete and Deactivate', <PLUGIN_TEXT_DOMAIN> ),
'delete_button' => __( 'Delete', <PLUGIN_TEXT_DOMAIN> ),
'license_active_label' => __( 'License Active', <PLUGIN_TEXT_DOMAIN> ),
'license_inactive_label' => __( 'License Inactive', <PLUGIN_TEXT_DOMAIN> ),
'save_activate_button' => __( 'Save and Activate', <PLUGIN_TEXT_DOMAIN> ),
),
'license_nag' => array(
'register_message' => _x( 'Register your copy of %s now to receive automatic updates and support.', '%s is the Plugin Name', <PLUGIN_TEXT_DOMAIN> ),
'purchase_message' => _x( 'If you do not have a license key, you can %1$spurchase one%2$s.', 'Both %s are used to place HTML for the <a> in the message', <PLUGIN_TEXT_DOMAIN> ),
),
'license_activation' => _x( '%s license successfully activated.', '%s is the Plugin Name', <PLUGIN_TEXT_DOMAIN> ),
'license_deletion' => _x( '%s license successfully deleted.', '%s is the Plugin Name', <PLUGIN_TEXT_DOMAIN> ),
'license_deactivation' => array(
'error' => _x( 'Error: could not deactivate the license for %s', '%s is the Plugin Name', <PLUGIN_TEXT_DOMAIN> ),
'success' => _x( '%s license successfully deactivated.', '%s is the Plugin Name', <PLUGIN_TEXT_DOMAIN> ),
),
'license_error_messages' => array(
'expired' => _x( 'Your %s license key expired on %s.', 'The first %s is the Plugin name and the second %s is a localized timestamp', <PLUGIN_TEXT_DOMAIN> ),
'revoked' => __( 'Your license key has been disabled.', <PLUGIN_TEXT_DOMAIN> ),
'missing' => __( 'Invalid license.', <PLUGIN_TEXT_DOMAIN> ),
'site_inactive' => __( 'Your license is not active for this URL.', <PLUGIN_TEXT_DOMAIN> ),
'item_name_mismatch' => _x( 'This appears to be an invalid license key for %s.', '%s is the Plugin Name', <PLUGIN_TEXT_DOMAIN> ),
'no_activations_left' => __( 'Your license key has reached its activation limit.', <PLUGIN_TEXT_DOMAIN> ),
'manage_license_link_text' => __( 'You can manage your license key here.', <PLUGIN_TEXT_DOMAIN> ),
'no_connection' => _x( '%s cannot communicate with %s for License Key Validation. Please check your server configuration settings.', '%s is the Plugin Name followed by the Store URL', <PLUGIN_TEXT_DOMAIN> ),
'default' => __( 'An error occurred, please try again.', <PLUGIN_TEXT_DOMAIN> ),
),
'beta_checkbox' => array(
'label' => __( 'Enable Beta Releases', <PLUGIN_TEXT_DOMAIN> ),
'disclaimer' => __( 'Beta Releases should not be considered as Stable. Enabling this on your Production Site is done at your own risk.', <PLUGIN_TEXT_DOMAIN> ),
'enabled_message' => _x( 'Beta Releases for %s enabled.', '%s is the Plugin Name', <PLUGIN_TEXT_DOMAIN> ),
'disabled_message' => _x( 'Beta Releases for %s disabled.', '%s is the Plugin Name', <PLUGIN_TEXT_DOMAIN> ),
),
) );
$this->support->support_form()
outputs the Support Email Form (It automatically shows the different ones for Enabled and Disabled License Keys)
./wp-content/plugins/your-plugin/rbp-support/sidebar-support.php
for when a License Key is active./wp-content/plugins/your-plugin/rbp-support/sidebar-support-disabled.php
for when there is no active License Key$this->support->licensing_fields()
outputs the Activate/Deactivate License Field.
./wp-content/plugins/your-plugin/rbp-support/licensing-fields.php
$this->support->enqueue_all_scripts()
enqueues all the CSS/JS the submodule utitlizes
$this->support->enqueue_form_scripts()
or $this->support->enqueue_licensing_scripts()
for more control.$this->support->beta_checkbox()
outputs the Beta Releases checkbox and is entirely optional. When Editing your Download on the EDD Store, enable "Enable a beta version of this download" and set a Version Number and upload a ZIP to use as a Beta. Users enrolled into the Beta by checking this checkbox will be able to install the Beta from the comfort of their WordPress site.
./wp-content/plugins/your-plugin/rbp-support/beta-checkbox.php
1.2.0
and the Beta available is 1.2.0-beta1
it will not show as an option for the Customer. The Beta version must be higher than the installed version.1.2.0b1
1.2.0-beta1
That's it! That's all it takes using this Submodule. Everything is preconfigured for you and you have the option to change things up using a few Filters and overriding Templates.
<prefix>_license_key
in wp_options
.rbp_support_prefix
Filter if the only thing that doesn't match is the Prefix. Just be sure to remove the Filter as soon as your RBP_Support Object is created!settings_errors()
.
edd-notices
on its Settings Pages<prefix>_settings_error
<form>
. Because of this, if Required Fields were not filled out despite not intending to fill out the Support Form, it would not permit the Settings Page to be submitted.<div>
and toggling the required
attributes using JavaScript.<form>
functionality by doing the following:
add_filter( '<prefix>_support_form_tag', function() { return 'form'; }