Files
ogre-captcha/inc/location/class-login-form.php
T
Cooper Dalrymple e8b8fc1871
Validate Build / validate-build (push) Failing after 35s
Locations and verification
2026-06-04 17:05:42 -05:00

48 lines
964 B
PHP

<?php
/**
* @package ogre-captcha
* @author cleverogre
* @copyright 2026 CleverOgre
* @license GLP-3.0-or-later
* @version 0.0.0
* @since 0.0.0
*/
namespace Ogre\Captcha\Location;
use Override;
use Ogre\Captcha\Location;
use Ogre\Captcha\Settings;
defined('ABSPATH') || exit;
final class LoginForm extends Location {
protected function __construct() {
parent::__construct(Settings::LOCATION_LOGIN_FORM);
}
#[Override]
public function enabled(): bool
{
return is_user_logged_in() ? false : parent::enabled();
}
#[Override]
public function activate(): void
{
add_filter('login_form_middle', [$this, 'render_form'], 10, 2);
// NOTE: Requires login page processing
}
public function render_form(string $content, array $args):string {
ob_start();
$this->render();
$content .= ob_get_clean();
return $content;
}
}
LoginForm::instance();