-
-
Notifications
You must be signed in to change notification settings - Fork 29
How to Use the New Shortcodes and Blocks
-
Forgot License:
[slm_forgot_license]
- Displays a form where users can enter their email to retrieve license information.
- Can be added to any page or post manually.
-
List Licenses:
[slm_list_licenses]
- Dynamically displays a table of licenses associated with the logged-in user.
- Useful for pages where users manage their licenses.
-
Forgot License Block:
- Found under the "SLM Plus" category in the block editor.
- Provides an interactive form preview in the editor.
- On the frontend, renders the
[slm_forgot_license]
shortcode.
The following hooks allow developers to customize various aspects of the plugin's functionality, such as error messages, email content, and form labels. These hooks provide flexibility while maintaining the core functionality.
Purpose: Customize the error message displayed when the user enters an invalid email address in the "Forgot License" form.
"Invalid email address."
add_filter('slm_invalid_email_message', function($message) {`
`return '<p style="color: red;">The email address you entered is not valid. Please try again.</p>';`
`});
Modify the success message displayed after the user successfully submits the "Forgot License" form and licenses are emailed.
"Your licenses have been sent to your email."
add_filter('slm_success_message', function($message) {`
`return '<p style="color: green;">Check your inbox! We have sent your licenses to your registered email address.</p>';`
`});
Change the message displayed when no licenses are found for the provided email address.
"No licenses found for the provided email."
add_filter('slm_no_license_message', function($message) {`
`return '<p style="color: orange;">Sorry, we couldn’t find any licenses associated with this email. Please check and try again.</p>';`
`});
Modify the body of the email sent to users after they request their licenses.
A list of licenses formatted as plain text.
add_filter('slm_license_email_message', function($message, $licenses) {`
`$customMessage = "Here are your licenses:\n\n";`
`foreach ($licenses as $license) {`
`$customMessage .= "License Key: {$license['license_key']}\n";`
`$customMessage .= "Product: {$license['product_ref']}\n";`
`$customMessage .= "Status: {$license['lic_status']}\n";`
`$customMessage .= "Expiry Date: {$license['date_expiry']}\n\n";`
`}`
`return $customMessage;`
`}, 10, 2);
Customize the subject line of the email sent to users after they request their licenses.
"Your Licenses"
add_filter('slm_license_email_subject', function($subject) {`
`return 'Your Requested License Keys';`
`});
Purpose: Customize the label text for the email input field in the "Forgot License" form.
"Enter your email address:"
add_filter('slm_form_label', function($label) {
return 'Please provide your registered email to retrieve licenses:';
});
Purpose: Customize the text displayed on the submit button in the "Forgot License" form.
"Retrieve License"
add_filter('slm_form_button_text', function($buttonText) {
return 'Send License Information';
});
Add the examples to your theme’s functions.php file or a custom plugin to apply these customizations. Each hook has been designed to be simple and easy to use, allowing you to adapt the plugin to specific requirements without modifying the core plugin files. By leveraging these hooks, you can fully customize the "Forgot License" form and email messages to match your branding and user experience needs.
Updated and maintained by Epikly