Changeset 3352346
- Timestamp:
- 08/28/2025 11:41:22 PM (7 months ago)
- Location:
- block-user-account
- Files:
-
- 13 added
- 1 deleted
- 8 edited
-
assets/banner-1544x500.png (added)
-
assets/banner-772x250.png (added)
-
assets/screenshot-1.PNG (modified) (previous)
-
assets/screenshot-2.PNG (modified) (previous)
-
assets/screenshot-3.PNG (modified) (previous)
-
tags/1.4 (added)
-
tags/1.4/block-user-account.php (added)
-
tags/1.4/css (added)
-
tags/1.4/css/style.css (added)
-
tags/1.4/index.php (added)
-
tags/1.4/languages (added)
-
tags/1.4/languages/block-user-account-fa_IR.l10n.php (added)
-
tags/1.4/languages/block-user-account-fa_IR.mo (added)
-
tags/1.4/languages/block-user-account-fa_IR.po (added)
-
tags/1.4/readme.txt (added)
-
trunk/block-user-account.php (modified) (12 diffs)
-
trunk/css/style.css (modified) (1 diff)
-
trunk/languages/block-user-account-fa_IR.l10n.php (added)
-
trunk/languages/block-user-account-fa_IR.mo (modified) (previous)
-
trunk/languages/block-user-account-fa_IR.po (modified) (5 diffs)
-
trunk/languages/block-user-account.pot (deleted)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
block-user-account/trunk/block-user-account.php
r2790779 r3352346 4 4 * Plugin URI: https://dangoweb.ir/product/buacc-wordpress-user-block-plugin/ 5 5 * Description: Block Users Accounts On your Site. 6 * Version: 1. 3.16 * Version: 1.4 7 7 * Author: DangoWeb 8 8 * Author URI: https://dangoweb.ir … … 29 29 $current_user_id = get_current_user_id(); 30 30 if ($user_id != $current_user_id): 31 wp_enqueue_style('user_status_style', BUA_CSS_URL . '/style.css'); 32 if (current_user_can('edit_users')): 33 ?> 31 if (current_user_can('edit_users')): ?> 34 32 <table class="form-table" id="block_user"> 35 33 <tr> … … 38 36 </th> 39 37 <td> 40 <label class=" tgl">41 <input type="checkbox" name="user_status" value="deactive"38 <label class="bua-toggle-switch"> 39 <input type="checkbox" class="toggle-input" name="user_status" value="deactive" 42 40 id="user_status" <?php checked(get_user_meta($user_id, 'user_status', true), 'deactive'); ?>> 43 <span data-off="<?php _e("Enabled", 'block-user-account'); ?>" 44 data-on="<?php _e("Disabled", 'block-user-account'); ?>"></span> 41 <span class="bua-toggle-slider"></span> 45 42 </label> 46 < span class="description"><?php _e("Green: Account is Active. / Red: Account is Blocked.", 'block-user-account'); ?></span>43 <p class="description"><?php _e("Green: Account is Active. / Red: Account is Blocked.", 'block-user-account'); ?></p> 47 44 </td> 48 45 </tr> … … 59 56 </td> 60 57 </tr> 61 <script>62 jQuery(function ($) {63 var checkbox = document.querySelector("#user_status");64 var input = document.querySelector("#user_status_message");65 var toogleInput = function (e) {66 input.disabled = !e.target.checked;67 };68 toogleInput({target: checkbox});69 checkbox.addEventListener("change", toogleInput);70 });71 </script>72 58 </table> 73 59 <?php … … 76 62 77 63 return; 78 }79 80 //Session81 function bua_destroy_user_session($user_id)82 {83 $sessions = WP_Session_Tokens::get_instance($user_id);84 $sessions->destroy_all();85 64 } 86 65 … … 101 80 delete_user_meta($user_id, 'user_status_message'); 102 81 endif; 103 bua_destroy_user_session($user_id); 82 $sessions = WP_Session_Tokens::get_instance($user_id); 83 $sessions->destroy_all(); 104 84 endif; 105 85 106 return; 86 107 87 } 108 88 109 89 //Bulk Actions 110 add_filter('bulk_actions-users', 'bua_ bulk_actions');111 function bua_ bulk_actions($bulk_actions)90 add_filter('bulk_actions-users', 'bua_user_bulk_actions'); 91 function bua_user_bulk_actions($bulk_actions) 112 92 { 113 93 $bulk_actions['bua_block_users'] = __('Block Users', 'block-user-account'); … … 116 96 } 117 97 118 add_filter('handle_bulk_actions-users', 'bua_ bulk_actions_handle', 10, 3);119 function bua_ bulk_actions_handle($redirect_to, $action, $user_ids)98 add_filter('handle_bulk_actions-users', 'bua_user_bulk_actions_handle', 10, 3); 99 function bua_user_bulk_actions_handle($redirect_to, $action, $user_ids) 120 100 { 121 101 $current_user_id = get_current_user_id(); 102 103 if (!current_user_can('edit_users')) { 104 return $redirect_to; 105 } 106 122 107 if ($action == 'bua_block_users') { 123 108 foreach ($user_ids as $user_id) { 124 if (current_user_can('edit_users')) { 125 if ($user_id != $current_user_id) { 126 update_user_meta($user_id, 'user_status', 'deactive'); 127 bua_destroy_user_session($user_id); 128 } 109 if ($user_id != $current_user_id) { 110 update_user_meta($user_id, 'user_status', 'deactive'); 111 $sessions = WP_Session_Tokens::get_instance($user_id); 112 $sessions->destroy_all(); 129 113 } 130 if (!current_user_can('edit_users')) {131 wp_die(__('Sorry, you are not allowed to edit this user.'), 403);132 }133 134 114 } 135 $redirect_to = add_query_arg('bua_block_users', count($user_ids), $redirect_to);136 // $redirect_to = remove_query_arg('bua_block_users', $redirect_to);137 115 } elseif ($action == 'bua_active_users') { 138 116 foreach ($user_ids as $user_id) { 139 if (current_user_can('edit_users')) { 140 delete_user_meta($user_id, 'user_status'); 141 } 142 if (!current_user_can('edit_users')) { 143 wp_die(__('Sorry, you are not allowed to edit this user.'), 403); 144 } 117 delete_user_meta($user_id, 'user_status'); 145 118 } 146 $redirect_to = add_query_arg('bua_active_users', count($user_ids), $redirect_to);147 119 } 120 148 121 return $redirect_to; 149 }150 151 add_action('admin_notices', 'bua_bulk_action_notice');152 function bua_bulk_action_notice()153 {154 if (!empty($_REQUEST['bua_block_users']) && isset($_REQUEST['bua_block_users'])) {155 $changes = intval($_REQUEST['bua_block_users']);156 printf('<div id="message" class="updated notice is-dismissable"><p>' . __('%d Users were Blocked.', 'block-user-account') . '</p></div>', $changes);157 }158 if (!empty($_REQUEST['bua_active_users']) && isset($_REQUEST['bua_active_users'])) {159 $changes = intval($_REQUEST['bua_active_users']);160 printf('<div id="message" class="updated notice is-dismissable"><p>' . __('%d Users Activated.', 'block-user-account') . '</p></div>', $changes);161 }162 122 } 163 123 … … 166 126 function bua_user_status_column($column) 167 127 { 168 $column[' user_status'] = __('User Status', 'block-user-account');169 $column[' user_status_reasen'] = __('Blocked Reason', 'block-user-account');128 $column['bua_user_status'] = __('User Status', 'block-user-account'); 129 $column['bua_user_status_reasen'] = __('Blocked Reason', 'block-user-account'); 170 130 return $column; 171 131 } … … 174 134 function bua_show_user_status($value, $column, $userid) 175 135 { 176 wp_enqueue_style('user_status_style', BUA_CSS_URL . '/style.css');177 136 $active = __('Active', 'block-user-account'); 178 137 $blocked = __('Blocked', 'block-user-account'); … … 180 139 $user_status_message = get_user_meta($userid, 'user_status_message', true); 181 140 182 if (' user_status' == $column) {141 if ('bua_user_status' == $column) { 183 142 if ($user_status === 'deactive') { 184 return "<span class='user-status-deactive'>" . $blocked . "</span>";143 return '<span class="user-status-deactive"><svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 -960 960 960" width="20px"><path d="M480-80q-139-35-229.5-159.5T160-516v-244l320-120 320 120v244q0 152-90.5 276.5T480-80Zm0-84q104-33 172-132t68-220v-189l-240-90-240 90v189q0 121 68 220t172 132Zm0-316Zm-80 160h160q17 0 28.5-11.5T600-360v-120q0-17-11.5-28.5T560-520v-40q0-33-23.5-56.5T480-640q-33 0-56.5 23.5T400-560v40q-17 0-28.5 11.5T360-480v120q0 17 11.5 28.5T400-320Zm40-200v-40q0-17 11.5-28.5T480-600q17 0 28.5 11.5T520-560v40h-80Z"/></svg>' . $blocked . '</span>'; 185 144 } else { 186 return "<span class='user-status-active'>" . $active . "</span>";145 return '<span class="user-status-active"><svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 -960 960 960" width="20px"><path d="m438-338 226-226-57-57-169 169-84-84-57 57 141 141Zm42 258q-139-35-229.5-159.5T160-516v-244l320-120 320 120v244q0 152-90.5 276.5T480-80Zm0-84q104-33 172-132t68-220v-189l-240-90-240 90v189q0 121 68 220t172 132Zm0-316Z"/></svg>' . $active . '</span>'; 187 146 } 188 147 } 189 if (' user_status_reasen' == $column) {148 if ('bua_user_status_reasen' == $column) { 190 149 if ($user_status == 'deactive') { 191 150 return "<div>" . $user_status_message . "</div>"; … … 200 159 function bua_login_authenticate($user, $username) 201 160 { 202 if (is_email($username)): 161 $userinfo = get_user_by('login', $username); 162 if (!$userinfo && is_email($username)) { 203 163 $userinfo = get_user_by('email', $username); 204 else: 205 $userinfo = get_user_by('login', $username); 206 endif; 207 164 } 208 165 if (!$userinfo) { 209 166 return $user; 210 167 } elseif (get_user_meta($userinfo->ID, 'user_status', true) === 'deactive') { 211 168 $user_message = get_user_meta($userinfo->ID, 'user_status_message', true); 212 $default_message = __('Your account is disabled.', 'block-user-account');169 $default_message = __('Your account has been temporarily disabled. Please contact the administrator.', 'block-user-account'); 213 170 $message = !empty($user_message) ? $user_message : $default_message; 214 171 $error = new WP_Error(); … … 220 177 return $user; 221 178 } 179 180 add_action('admin_enqueue_scripts', function ($hook) { 181 if ($hook == 'user-edit.php' || $hook == 'profile.php' || $hook == 'users.php') { 182 wp_enqueue_style('bua_admin_style', BUA_CSS_URL . '/style.css'); 183 } 184 }); -
block-user-account/trunk/css/style.css
r2278828 r3352346 1 1 .column-user_status, 2 2 .user_status_reasen, 3 .column-user_status_reasen {4 text-align: center !important;5 vertical-align: middle !important;3 .column-user_status_reasen { 4 text-align: center !important; 5 vertical-align: middle !important; 6 6 } 7 .user-status-active{ 8 background-color: #79d122; 7 8 .user-status-deactive, 9 .user-status-active { 10 background-color: #2ecc71; 9 11 color: #FFF; 10 padding:3px 10px; 12 fill: #FFF; 13 padding: 3px 10px; 11 14 border-radius: 3px; 15 display: inline-flex; 16 align-items: center; 17 justify-content: center; 18 min-width: 65px; 12 19 } 13 .user-status-active:hover{ 14 background-color: #62af1e; 20 21 .user-status-deactive { 22 background-color: #e74c3c; 15 23 } 16 .user-status-deactive{ 17 background-color: #c63d3d; 18 color: #FFF; 19 padding:3px 10px; 20 border-radius: 3px; 24 25 .bua-toggle-switch .toggle-input { 26 display: none; 21 27 } 22 .user-status-deactive:hover{ 23 background-color: #b13838; 28 29 .bua-toggle-switch { 30 position: relative; 31 display: inline-block; 32 width: 60px; 33 height: 25px; 24 34 } 25 .tgl { 26 position: relative; 27 outline: 0; 28 display: inline-block; 29 cursor: pointer; 30 user-select: none; 31 margin: 0 0 5px 0; 35 36 .bua-toggle-slider { 37 position: absolute; 38 cursor: pointer; 39 top: 0; 40 left: 0; 41 right: 0; 42 bottom: 0; 43 background-color: #2ecc71; 44 transition: 0.4s; 45 border-radius: 34px; 32 46 } 33 .tgl, 34 .tgl:after, 35 .tgl:before, 36 .tgl *, 37 .tgl *:after, 38 .tgl *:before, 39 .tgl + .tgl-btn { 40 box-sizing: border-box; 47 48 .bua-toggle-slider:before { 49 position: absolute; 50 content: ""; 51 height: 20px; 52 width: 20px; 53 left: 5px; 54 bottom: 3px; 55 background-color: white; 56 transition: 0.4s; 57 border-radius: 50%; 41 58 } 42 .tgl::selection, 43 .tgl:after::selection, 44 .tgl:before::selection, 45 .tgl *::selection, 46 .tgl *:after::selection, 47 .tgl *:before::selection, 48 .tgl + .tgl-btn::selection { 49 background: none; 59 60 .toggle-input:checked + .bua-toggle-slider { 61 background-color: #e74c3c; 50 62 } 51 .tgl span { 52 position: relative; 53 display: block; 54 height: 1.8em; 55 line-height: 1.2em; 56 overflow: hidden; 57 font-weight: normal; 58 text-align: center; 59 border-radius: 2em; 60 padding: 0.2em 1em; 61 border: 1px solid #fafafa; 62 box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.2), 0 2px 0 rgba(255, 255, 255, 0.7); 63 transition: color 0.3s ease, padding 0.3s ease-in-out, background 0.3s ease-in-out; 63 64 .toggle-input:checked + .bua-toggle-slider:before { 65 transform: translateX(30px); 64 66 } 65 .tgl span:before {66 position: relative;67 display: block;68 line-height: 1.3em;69 padding: 0 0.2em;70 font-size: 1em;71 }72 .tgl span:after {73 position: absolute;74 display: block;75 content: '';76 border-radius: 2em;77 width: 1.3em;78 height: 1.3em;79 margin-left: -1.45em;80 top: 0.2em;81 background: #FFFFFF;82 transition: left 0.3s cubic-bezier(0.175, 0.885, 0.32, 0.97), background 0.3s ease-in-out;83 }84 .tgl input[type="checkbox"] {85 display: none !important;86 }87 .tgl input[type="checkbox"]:not(:checked) + span {88 background: #86d993;89 color: #FFFFFF;90 padding-left: 1.6em;91 padding-right: 0.4em;92 }93 .tgl input[type="checkbox"]:not(:checked) + span:before {94 content: attr(data-off);95 color: #FFFFFF;96 }97 .tgl input[type="checkbox"]:not(:checked) + span:after {98 background: #FFFFFF;99 left: 1.6em;100 }101 .tgl input[type="checkbox"]:checked + span {102 background: #de474e;103 color: #FFFFFF;104 padding-left: 0.4em;105 padding-right: 1.6em;106 }107 .tgl input[type="checkbox"]:checked + span:before {108 content: attr(data-on);109 }110 .tgl input[type="checkbox"]:checked + span:after {111 background: #FFFFFF;112 left: 100%;113 } -
block-user-account/trunk/languages/block-user-account-fa_IR.po
r2691596 r3352346 2 2 msgstr "" 3 3 "Project-Id-Version: Block User Account\n" 4 "POT-Creation-Date: 202 2-03-09 20:39+0330\n"5 "PO-Revision-Date: 202 2-03-09 20:39+0330\n"4 "POT-Creation-Date: 2025-08-29 02:30+0330\n" 5 "PO-Revision-Date: 2025-08-29 02:30+0330\n" 6 6 "Last-Translator: \n" 7 7 "Language-Team: \n" … … 11 11 "Content-Transfer-Encoding: 8bit\n" 12 12 "Plural-Forms: nplurals=1; plural=0;\n" 13 "X-Generator: Poedit 2.4.2\n"13 "X-Generator: Poedit 3.7\n" 14 14 "X-Poedit-Basepath: ..\n" 15 15 "X-Poedit-Flags-xgettext: --add-comments=translators:\n" 16 16 "X-Poedit-WPHeader: block-user-account.php\n" 17 17 "X-Poedit-SourceCharset: UTF-8\n" 18 "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;" 19 "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;" 20 "_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n" 18 "X-Poedit-KeywordsList: " 19 "__;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n" 21 20 "X-Poedit-SearchPath-0: .\n" 22 21 "X-Poedit-SearchPathExcluded-0: *.js\n" 23 22 24 #: block-user-account.php:3 723 #: block-user-account.php:35 25 24 msgid "User Account Status" 26 25 msgstr "وضعیت حساب کاربر" 27 26 28 27 #: block-user-account.php:43 29 msgid "Enabled"30 msgstr "فعال"31 32 #: block-user-account.php:4433 msgid "Disabled"34 msgstr "غیرفعال"35 36 #: block-user-account.php:4637 28 msgid "Green: Account is Active. / Red: Account is Blocked." 38 29 msgstr "سبز: حساب فعال است. / قرمز: حساب مسدود است." 39 30 40 #: block-user-account.php: 5231 #: block-user-account.php:49 41 32 msgid "Why the user is blocked Message" 42 33 msgstr "پیام چرا کاربر مسدود شده است" 43 34 44 #: block-user-account.php: 11335 #: block-user-account.php:93 45 36 msgid "Block Users" 46 37 msgstr "مسدودسازی کاربر" 47 38 48 #: block-user-account.php: 11439 #: block-user-account.php:94 49 40 msgid "Active Users" 50 41 msgstr "فعال کردن کاربر" 51 42 52 #: block-user-account.php:131 block-user-account.php:143 53 msgid "Sorry, you are not allowed to edit this user." 54 msgstr "متاسفیم، شما مجاز به ویرایش این کاربر نیستید." 55 56 #: block-user-account.php:156 57 #, php-format 58 msgid "%d Users were Blocked." 59 msgstr "%d کاربر مسدود شدند." 60 61 #: block-user-account.php:160 62 #, php-format 63 msgid "%d Users Activated." 64 msgstr "%d کاربر فعال شدند." 65 66 #: block-user-account.php:168 43 #: block-user-account.php:128 67 44 msgid "User Status" 68 45 msgstr "وضعیت کاربر" 69 46 70 #: block-user-account.php:1 6947 #: block-user-account.php:129 71 48 msgid "Blocked Reason" 72 49 msgstr "دلیل مسدودی" 73 50 74 #: block-user-account.php:1 7751 #: block-user-account.php:136 75 52 msgid "Active" 76 53 msgstr "فعال" 77 54 78 #: block-user-account.php:1 7855 #: block-user-account.php:137 79 56 msgid "Blocked" 80 57 msgstr "مسدود" 81 58 82 #: block-user-account.php:212 83 msgid "Your account is disabled." 84 msgstr "حساب کاربری شما غیرفعال شده است." 59 #: block-user-account.php:169 60 msgid "" 61 "Your account has been temporarily disabled. Please contact the administrator." 62 msgstr "حساب کاربری شما مسدود شده است. لطفا با مدیریت ارتباط برقرار کنید." 85 63 86 64 #. Plugin Name of the plugin/theme … … 89 67 90 68 #. Plugin URI of the plugin/theme 91 msgid "https:// zoroufchi.ir/block-user-account-wordpress-plugin"92 msgstr "https:// zoroufchi.ir/block-user-account-wordpress-plugin"69 msgid "https://dangoweb.ir/product/buacc-wordpress-user-block-plugin/" 70 msgstr "https://dangoweb.ir/product/buacc-wordpress-user-block-plugin/" 93 71 94 72 #. Description of the plugin/theme … … 97 75 98 76 #. Author of the plugin/theme 99 msgid " Mahmoud Zoroufchi"100 msgstr " محمود ظروفچی"77 msgid "DangoWeb" 78 msgstr "دانگو وب" 101 79 102 80 #. Author URI of the plugin/theme 103 msgid "https://zoroufchi.ir" 104 msgstr "https://zoroufchi.ir" 81 msgid "https://dangoweb.ir" 82 msgstr "https://dangoweb.ir" 83 84 #~ msgid "Enabled" 85 #~ msgstr "فعال" 86 87 #~ msgid "Disabled" 88 #~ msgstr "غیرفعال" 89 90 #~ msgid "Sorry, you are not allowed to edit this user." 91 #~ msgstr "متاسفیم، شما مجاز به ویرایش این کاربر نیستید." 92 93 #, php-format 94 #~ msgid "%d Users were Blocked." 95 #~ msgstr "%d کاربر مسدود شدند." 96 97 #, php-format 98 #~ msgid "%d Users Activated." 99 #~ msgstr "%d کاربر فعال شدند." 100 101 #~ msgid "Your account is disabled." 102 #~ msgstr "حساب کاربری شما غیرفعال شده است." 103 104 #~ msgid "Mahmoud Zoroufchi" 105 #~ msgstr "محمود ظروفچی" 106 107 #~ msgid "https://zoroufchi.ir" 108 #~ msgstr "https://zoroufchi.ir" 105 109 106 110 #~ msgid "" … … 114 118 #~ msgid "This Plugin can Block the User Account." 115 119 #~ msgstr "مسدودساز حساب کاربری" 116 117 #~ msgid "https://dangoweb.ir/"118 #~ msgstr "https://dangoweb.ir/" -
block-user-account/trunk/readme.txt
r3168829 r3352346 3 3 Donate link: https://zarinp.al/dangoweb.ir 4 4 Tags: block user, disable account, block account 5 Requires at least: 6. 06 Tested up to: 6. 77 Stable tag: 1. 3.15 Requires at least: 6.5 6 Tested up to: 6.8 7 Stable tag: 1.4 8 8 Requires PHP: 7.4 9 9 License: GPLv2 or later … … 31 31 32 32 == Changelog == 33 = 1.4.0 = 34 * Improved compatibility with WordPress 6.8 35 33 36 = 1.3.0 = 34 37 * ADD Bulk Actions
Note: See TracChangeset
for help on using the changeset viewer.