kompass/modules/Registration/Controllers/class-extendregistrationform.php

39 lines
1.3 KiB
PHP

<?php
/**
* File: class-extendregistrationform.php
*
*
* @since 2024-07-30
* @license GPL-3.0-or-later
*
* @package mareike/
*/
namespace Bdp\Modules\Registration\Controllers;
class ExtendRegistrationForm {
public static function execute() {
?>
<p>
<label for="first_name">Vorname<br />
<input required style="width: 768px !important;" type="text" name="first_name" id="first_name" class="input" value="<?php echo esc_attr(wp_unslash($_POST['first_name'] ?? '')); ?>" size="25" /></label>
</p>
<p>
<label for="last_name">Nachname<br />
<input required style="width: 768px !important;" type="text" name="last_name" id="last_name" class="input" value="<?php echo esc_attr(wp_unslash($_POST['last_name'] ?? '')); ?>" size="25" /></label>
</p>
<?php
}
public static function error_messages($errors, $sanitized_user_login, $user_email) {
if (empty($_POST['first_name']) || !empty($_POST['first_name']) && trim($_POST['first_name']) == '') {
$errors->add('first_name_error', '<strong>FEHLER</strong>: Der Vorname ist erforderlich.');
}
if (empty($_POST['last_name']) || !empty($_POST['last_name']) && trim($_POST['last_name']) == '') {
$errors->add('last_name_error', '<strong>FEHLER</strong>: DEr Nachname ist erforderlich.');
}
return $errors;
}
}