Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions inc/admin-pages/class-checkout-form-list-admin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ public function render_add_new_checkout_form_modal(): void {
'title' => __('Multi-Step', 'ultimate-multisite'),
'icon' => 'dashicons-before dashicons-excerpt-view',
],
'simple' => [
'title' => __('Simple (Email Only)', 'ultimate-multisite'),
'icon' => 'dashicons-before dashicons-email-alt',
],
'blank' => [
'title' => __('Blank', 'ultimate-multisite'),
'icon' => 'dashicons-before dashicons-admin-page',
Expand Down
33 changes: 33 additions & 0 deletions inc/checkout/class-checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -2140,8 +2140,41 @@ public function get_checkout_variables() {
*/
public function get_js_validation_rules(): array {

/*
* When the checkout form has a password field with auto_generate_password
* enabled, the hidden flag is submitted with the form but is not present
* in the GET request at render time. We detect this from the form settings
* so the JS validator knows to skip password rules without needing the
* flag to be in the request.
*/
$form_auto_generates_password = false;

if ($this->checkout_form) {
$password_fields = $this->checkout_form->get_all_fields_by_type('password');

foreach ($password_fields as $field) {
if (! empty($field['auto_generate_password'])) {
$form_auto_generates_password = true;
break;
}
}
}

$raw_rules = $this->validation_rules();

/*
* When the form auto-generates the password, clear the password rules
* so the JS validator does not require a password field that is not
* rendered. The server-side validation_rules() already handles this via
* request_or_session(), but at render time the flag is not in the request
* so we must detect it from the form settings instead.
*/
if ($form_auto_generates_password) {
$raw_rules['password'] = '';
$raw_rules['password_conf'] = '';
$raw_rules['valid_password'] = '';
}

/*
* Rules that require a database lookup or complex server-side logic.
* These are skipped for client-side validation.
Expand Down
15 changes: 15 additions & 0 deletions inc/class-wp-ultimo.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,21 @@ final class WP_Ultimo {
*/
public function init(): void {

/*
* Ensure wu_dmtable is registered on $wpdb early in the plugin load.
* Domain_Mapping::startup() only runs during the sunrise/mu-plugins phase
* (it returns early if muplugins_loaded has already fired). Without this,
* any code that accesses $wpdb->wu_dmtable before Domain_Mapping::startup()
* runs triggers a PHP notice about an undefined property, which causes
* "headers already sent" errors that break admin redirects and AJAX.
*/
global $wpdb;

if (empty($wpdb->wu_dmtable)) {
$wpdb->wu_dmtable = $wpdb->base_prefix . 'wu_domain_mappings';
$wpdb->ms_global_tables[] = 'wu_domain_mappings';
}

add_filter('extra_plugin_headers', [$this, 'register_addon_headers']);
add_action('admin_init', [$this, 'check_addon_compatibility']);

Expand Down
10 changes: 10 additions & 0 deletions inc/models/class-domain.php
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,16 @@ public static function get_by_domain($domains) {

$placeholders_in = implode(',', $placeholders);

/*
* Ensure wu_dmtable is set on $wpdb. In normal (non-sunrise) plugin load
* paths Domain_Mapping::startup() may not have run yet, which causes a
* PHP notice about an undefined property. Set it here as a fallback so
* the query can proceed without warnings.
*/
if (empty($wpdb->wu_dmtable)) {
$wpdb->wu_dmtable = $wpdb->base_prefix . 'wu_domain_mappings';
}

// Prepare the query
$query = "SELECT * FROM {$wpdb->wu_dmtable} WHERE domain IN ($placeholders_in) ORDER BY primary_domain DESC, active DESC, secure DESC LIMIT 1";

Expand Down
Loading