I'm created a plugin that replaces a previous plugin I wrote and adds some extra stuff too. I want to create an alert in the settings page of my old plugin with a link to download and install my new plugin and inform them that the old plugin is no longer supported by its developer. Currently, from the plugin page of my admin panel, install links look like this:
http://www.example.com/wp-admin/network/update.php?action=install-plugin&plugin=wptouch&_wpnonce=a8d64aa295
It seems to me there are at least two things too keep in mind when creating the URI:
Does anybody know how to properly do this? Is there anything else I need to consider when generating this URI?
Thanks in advance for your help.
I've found an answer. In wp-admin/import.php
, there's a great example of how this work.
Here is my implementation:
$plugin_name = 'my_plugin_name';
$install_link = '<a href="' . esc_url( network_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin_name . '&TB_iframe=true&width=600&height=550' ) ) . '" class="thickbox" title="More info about ' . $plugin_name . '">Install ' . $plugin_name . '</a>';
Then just output that link tag anywhere in your admin pages.
If you want to get fancy and add the thickbox modal window effect, just use the function add_thickbox()
and attach it to an action that's called in a typical admin request, such as:
add_action('admin_menu', 'my_plugin_add_thickbox');
function my_plugin_add_thickbox() {
add_thickbox();
}
That should do it!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With