• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Tips and Tricks HQ

  • Home
  • Blog
  • Projects
    • All Projects
    • Simple WP Shopping Cart
    • WP Express Checkout Plugin
    • WP Download Monitor
    • WP Security and Firewall Plugin
    • WP eStore Plugin
    • WP Affiliate Platform
    • WP eMember
    • WP Lightbox Ultimate
    • WP Photo Seller
  • Products
    • All Products
    • Checkout
  • Support
    • Support Portal
    • Customer Only Forum
    • WP eStore Documentation
    • WP Affiliate Software Documentation
    • WP eMember Documentation
  • Contact

Adding Your Own Custom Fields in the Software License Manager Plugin

You are here: Home / Web Development / Adding Your Own Custom Fields in the Software License Manager Plugin

Last updated: May 26, 2022




This is a tutorial for the Software License Manger plugin. This tutorial is aimed at advanced WordPress Plugin developers.

Lets say, you want to create an extension or a custom plugin to add couple of extra fields to save some info with each of the license keys. Below is a guideline on how to do it.



Decide Where You Will Save the Data

You need to first decide where this extra data will be saved. There are 3 choices:

1) Alter the License Key Table

When your custom plugin/extension is activated, you would alter the core plugin’s license key database table (wp_lic_key_tbl) and add the new columns.

2) Create Your Own Custom Table

You can create your own custom database table to store the values. Each license key has a unique ID that identifies the key in the license keys table of the core plugin. In your new table, you need to have a column to store that unique ID of the license key. That will allow you to connect each row of your table to a license key.

3) Use Custom Post Types

You can also create your own Custom Post Types and store the custom values there.

The key element to understand is that you need to use the unique ID of the keys to connect your custom data to a license key.

Show the Fields in the Add/Edit Licenses Interface

The following action hook can be used to add the HTML code for your custom fields. This hook is triggered by the core plugin just above the “Save Record” button.

slm_add_edit_interface_above_submit

Code Example:

add_action('slm_add_edit_interface_above_submit', 'my_custom_output');
function my_custom_output($data){
    $row_id = $data['row_id'];
    $key = $data['key'];
    //TODO - echo something here
    echo 'My Custom Field: <input type="text" name="my_test_field" value="...." />';
}

Save the Custom Data When a License Key is Saved

You can use any of the following two action hooks to listen for the form submission then read the values from the REQUEST parameter and save the custom data.

slm_add_edit_interface_save_submission

or

slm_add_edit_interface_save_record_processed

Code Example:

add_action('slm_add_edit_interface_save_record_processed', 'save_my_custom_data');
function save_my_custom_data($data){
    $row_id = $data['row_id'];
    $key = $data['key'];
    //TODO - read your custom data from the REQUEST parameter and save it.
}

That should do it. Your custom plugin/extension can now add, edit and show extra custom fields for each license key.

Related Posts

  • Upgrading the Core WordPress Custom Menu Widget
  • WordPress Plugin – Cite the Source for Images Attached to Your WordPress Posts
  • WordPress Action Hooks and Filter Hooks – An Introduction
  • Hiding the Download URL of the File with Simple Download Monitor Plugin

Web Development,  Wordpress Plugin Code example,  plugin,  wordpress developer tutorial,  Wordpress Plugin,  WordPress tutorial,  WordPress Tweaks

Reader Interactions

Comments (4 responses)

  1. admin says:
    May 26, 2022 at 12:19 am

    @Rodrigo Souza, Thank you for pointing this out. The code was changed in the plugin but this page didn’t get updated. I have just updated it.

  2. Rodrigo Souza says:
    May 25, 2022 at 5:41 pm

    The example for ‘slm_add_edit_interface_above_submit’ is wrong. The action in plugin dispatch only 1 parameter, not 2 (only $data) and the hook is an action not a filter.

    This should be:
    //hook
    add_action(‘slm_add_edit_interface_above_submit’, ‘my_custom_output’, 10, 1);
    //funcion
    function my_custom_output($data){
    …
    echo “something”
    }
    Checked in 4.5.3 slm plugin version

  3. admin says:
    December 14, 2016 at 8:32 pm

    @Michel, Thank you. I have corrected it.

  4. Michel Velis says:
    December 14, 2016 at 2:26 pm

    there is a syntax error on:

    add_filter(‘slm_add_edit_interface_above_submit, ‘my_custom_output’, 10, 2);

    missing ‘ after slm_add_edit_interface_above_submit. should be

    add_filter(‘slm_add_edit_interface_above_submit’, ‘my_custom_output’, 10, 2);

Leave a Reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Featured & Popular Articles

Video Answers to Top WordPress QuestionsWordPress Optimization Tips and Tricks for Better Performance and SpeedEssential WordPress Security Tips - Is Your Blog Protected?WordPress Simple PayPal Shopping Cart PluginTop 15 Search Engine Optimization (SEO) Techniques I Forget to DoList of the Best and Must Use WordPress PluginsHow do I Start a Blog and Make Money Online?Good Domain Name Picking Tips for Your Blog SetupFind Out Which WordPress Web Hosting Company Offers the Cheapest and Reliable Web Hosting Solution

Featured WordPress Plugins

wordpress estore plugin
wordpress membership plugin
WP Express Checkout Plugin
WordPress Lightbox Ultimate Plugin
WordPress photo seller plugin
wordpress affiliate plugin

Recent Posts

  • Accept Donations via PayPal from Your WordPress Site Easil [...]
  • Buy Now Button Graphics for eCommerce Websites [...]
  • Subscription Button Graphics for eCommerce Websites [...]
  • Adding PayPal Payment Buttons to Your WordPress Sidebar Ea [...]
  • PayPal QR Codes [...]

Comment & Socialize

  • @Rodrigo Souza, Thank you f ...
    - admin
  • The example for 'slm_add_ed ...
    - Rodrigo Souza
  • @Ron, All the valid transac ...
    - admin
  • Hello, when people have sel ...
    - Ron
  • We have hte following featu ...
    - admin

Check out our solutions

View our WordPress plugin collection and start using them on your site.

Our WordPress Solutions

Footer

Company

  • About
  • Privacy Policy
  • Terms and Conditions
  • Affiliate Login

Top WordPress Plugins

  • Simple Shopping Cart
  • PayPal Donations
  • WP Express Checkout
  • WP eStore
  • WP eMember

Blogging Tips

  • How to Start a Blog
  • Selecting a Good Domain
  • Cheap WP Hosting
  • WP Video Tutorials
  • Simple SEO Tips

Search


Keep In Touch

Copyright © 2023 | Tips and Tricks HQ