Skip to content

Commit

Permalink
DB clean up on uninstall + added settings list on pluginlist
Browse files Browse the repository at this point in the history
  • Loading branch information
staude committed Feb 28, 2017
1 parent 964f253 commit 28db0bc
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
20 changes: 18 additions & 2 deletions class-disable-author-pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function __construct() {
add_action( 'admin_menu', array( 'disable_author_pages', 'options_menu' ) );
add_action( 'plugins_loaded', array( 'disable_author_pages', 'load_translations' ) );
add_filter( 'author_link', array( 'disable_author_pages', 'disable_author_link') );
add_filter( 'plugin_action_links_disable-author-pages/disable-author-pages.php' , array( 'disable_author_pages', 'plugin_settings_link' ) );
}

/**
Expand Down Expand Up @@ -158,8 +159,9 @@ static public function create_options_disable_author_menu() {
<tr>
<td></td>
<td>
<?php echo wp_dropdown_pages("name=disable_author_pages_destination&selected={$selectedpage}&echo=0"); ?>
<?php _e( 'Destinationpage', 'disable-author-pages' ); ?>
<?php
echo wp_dropdown_pages("name=disable_author_pages_destination&selected={$selectedpage}&echo=0");
_e( 'Destinationpage', 'disable-author-pages' ); ?>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -190,5 +192,19 @@ static public function create_options_disable_author_menu() {
</div>
<?php
}

/**
* add link on plugin page
*
* @param $links
* @return mixed
* @since 0.10
*/
function plugin_settings_link( $links ) {
$settings_link = '<a href="options-general.php?page=disable-author-pages%2Fclass-disable-author-pages.php">' . __('Settings', 'disable-author-pages') . '</a>';
array_unshift($links, $settings_link);
return $links;
}

}

9 changes: 5 additions & 4 deletions disable-author-pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
* Plugin URI: https://staude.net/wordpress/plugins/disable-author-pages/
* Description: Disable the author pages in WordPress and redirect to the homepage.
* Author: Frank Staude
* Version: 0.9
* Version: 0.10
* Text Domain: disable-author-pages
* Domain Path: languages
* Author URI: https://staude.net/
* Compatibility: WordPress 4.6.1
* Compatibility: WordPress 4.7.2
* GitHub Plugin URI: https://github.com/staude/disable-author-pages/
* GitHub Branch: master
*/

/* Copyright 2014-2016 Frank Staude (email : frank@staude.net)
/* Copyright 2014-2017 Frank Staude (email : frank@staude.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -39,7 +39,8 @@
* Delete options on plugin install
*/
function disable_author_pages_uninstall() {
//$wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key = 'backend_startpage';" );
global $wpdb;
$wpdb->query( "DELETE FROM $wpdb->options WHERE option_name like 'disable_author_pages_%';" );
}

register_uninstall_hook( __FILE__, 'disable_author_pages_uninstall' );
Expand Down
8 changes: 5 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Contributors:f.staude
Donate link: https://staude.net/donate/
Tags: widgets, page, post, sidebar, shortcode
Requires at least: 3.0
Tested up to: 4.6.1
Stable tag: 0.9
Tested up to: 4.7.2
Stable tag: 0.10
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand All @@ -25,7 +25,6 @@ Entrys in the changelog with numbers means the ticket id on http://bugs.staude.n
1. Configure it under settings/disable author pages

== Frequently Asked Questions ==
English:

= I have a new translation =

Expand All @@ -40,6 +39,9 @@ Please report it at https://github.com/staude/disable-author-pages/issues
Please report it at https://github.com/staude/disable-author-pages/issues

== Changelog ==
= 0.10 =
- DB clean up on uninstall
- added settings list on pluginlist

= 0.9 =
- fix: redirect to pages. Thanks to Georg
Expand Down

0 comments on commit 28db0bc

Please sign in to comment.