Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update version, add new method to return meta string #5

Merged
merged 1 commit into from
Nov 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion disable-user-login.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Disable User Login
* Plugin URI: http://wordpress.org/plugins/disable-user-login
* Description: Provides the ability to disable user accounts and prevent them from logging in.
* Version: 1.3.1
* Version: 1.3.2
*
* Author: Saint Systems
* Author URI: https://www.saintsystems.com
Expand Down
27 changes: 18 additions & 9 deletions includes/class-ss-disable-user-login-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class SS_Disable_User_Login_Plugin {
*
* @var string
*/
private static $version = '1.3.1';
private static $version = '1.3.2';

/**
* Plugin singleton instance
Expand All @@ -40,6 +40,15 @@ public static function version() {
return self::$version;
}

/**
* Returns the user meta key
*
* @return string
*/
public static function user_meta_key() {
return self::$user_meta_key;
}

/**
* Singleton instance
*
Expand Down Expand Up @@ -273,25 +282,25 @@ public function manage_users_columns( $defaults ) {
/**
* Set content of disabled users column
*
* @since 1.0.0
* @param empty $empty
* @since 1.3.2
* @param empty $output
* @param string $column_name
* @param int $user_ID
* @param int $user_id
* @return string
*/
public function manage_users_column_content( $empty, $column_name, $user_ID ) {
public function manage_users_column_content( $output, $column_name, $user_id ) {

if ( $column_name == 'disable_user_login' ) {
if ( get_the_author_meta( self::$user_meta_key, $user_ID ) == 1 ) {
if ( get_the_author_meta( self::$user_meta_key, $user_id ) == 1 ) {
return __( 'Disabled', 'disable-user-login' );
}
}

return $empty; // always return, otherwise we overwrite stuff from other plugins.
return $output; // always return, otherwise we overwrite stuff from other plugins.
}

/**
* Specifiy the width of our custom column
* Specify the width of our custom column
*
* @since 1.0.0
*/
Expand Down Expand Up @@ -419,7 +428,7 @@ private function maybe_trigger_enabled_disabled_actions( $user_id, $originally_d
do_action( 'disable_user_login.user_enabled', $user_id );
}
/**
* Trigger an action when a user's account is enabled
* Trigger an action when an enabled user's account is disabled
*
* @since 1.2.0
* @param int $user_id The ID of the user being disabled
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: users, user, login, account, disable
Requires at least: 4.7.0
Tested up to: 5.7
Requires PHP: 5.6
Stable tag: 1.3.1
Stable tag: 1.3.2
License: GPLv3

Provides the ability to disable user accounts and prevent them from logging in.
Expand Down Expand Up @@ -48,6 +48,10 @@ Yes, there is a filter in place for that, `disable_user_login_notice`.

== Changelog ==

= 1.3.2 =
* Static method to return user meta key
* Fix some comments

= 1.3.1 =
* Update to prevent disabling super admins on bulk disable.
* Update to check user edit permission on bulk disable.
Expand Down