| @@ -1299,9 +1299,9 @@ | ||
| 1299 | 1299 | __( 'Failed attempts', 'vigilante' ) => (string) $attempts, |
| 1300 | 1300 | __( 'Lockout duration', 'vigilante' ) => ceil( $duration / 60 ) . ' ' . __( 'minutes', 'vigilante' ), |
| 1301 | 1301 | __( 'Date/Time', 'vigilante' ) => wp_date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) ), |
| 1302 | 1302 | ) ); |
| 1303 | - $body .= Vigilante_Email_Template::button( admin_url( 'admin.php?page=vigilante&tab=login' ), __( 'View lockouts', 'vigilante' ) ); | |
| 1303 | + $body .= Vigilante_Email_Template::button( admin_url( 'admin.php?page=vigilante&tab=login#vigilante-section-login-status' ), __( 'View lockouts', 'vigilante' ) ); | |
| 1304 | 1304 | |
| 1305 | 1305 | Vigilante_Email_Template::send( $to, $subject, __( 'Login lockout triggered', 'vigilante' ), $body, true ); |
| 1306 | 1306 | } |
| 1307 | 1307 | |
| @@ -1549,43 +1549,8 @@ | ||
| 1549 | 1549 | public function get_locked_out_ips() { |
| 1550 | 1550 | return $this->database->get_locked_out_ips(); |
| 1551 | 1551 | } |
| 1552 | 1552 | |
| 1553 | - /** | |
| 1554 | - * Get login statistics | |
| 1555 | - * | |
| 1556 | - * @param int $days Days to look back. | |
| 1557 | - * @return array | |
| 1558 | - */ | |
| 1559 | - public function get_statistics( $days = 7 ) { | |
| 1560 | - global $wpdb; | |
| 1561 | - | |
| 1562 | - $table = esc_sql( $this->database->get_login_attempts_table() ); | |
| 1563 | - $since = gmdate( 'Y-m-d H:i:s', strtotime( "-{$days} days" ) ); | |
| 1564 | - | |
| 1565 | - // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.PreparedSQL.InterpolatedNotPrepared | |
| 1566 | - $stats = $wpdb->get_row( | |
| 1567 | - $wpdb->prepare( | |
| 1568 | - "SELECT | |
| 1569 | - COUNT(CASE WHEN status = 'failed' THEN 1 END) as failed_attempts, | |
| 1570 | - COUNT(CASE WHEN status = 'lockout' THEN 1 END) as lockouts, | |
| 1571 | - COUNT(DISTINCT ip_address) as unique_ips, | |
| 1572 | - COUNT(DISTINCT username) as unique_usernames | |
| 1573 | - FROM `{$table}` | |
| 1574 | - WHERE last_attempt >= %s", | |
| 1575 | - $since | |
| 1576 | - ), | |
| 1577 | - ARRAY_A | |
| 1578 | - ); | |
| 1579 | - // phpcs:enable | |
| 1580 | - | |
| 1581 | - return $stats ? $stats : array( | |
| 1582 | - 'failed_attempts' => 0, | |
| 1583 | - 'lockouts' => 0, | |
| 1584 | - 'unique_ips' => 0, | |
| 1585 | - 'unique_usernames' => 0, | |
| 1586 | - ); | |
| 1587 | - } | |
| 1588 | 1553 | } |
| 1589 | 1554 | |
| 1590 | 1555 | /** |
| 1591 | 1556 | * Disabled XML-RPC Server class |