Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/wp-user-frontend/includes/Admin/Forms/Form.php
+++ b/wp-user-frontend/includes/Admin/Forms/Form.php
@@ -194,7 +194,7 @@
}
if ( $this->is_charging_enabled() ) {
- $pay_per_post = $this->is_enabled_pay_per_post();
+ $pay_per_post = $this->is_enabled_pay_per_post();
// $pay_per_post_cost = (float) $this->get_pay_per_post_cost();
$force_pack = $this->is_enabled_force_pack();
@@ -208,10 +208,14 @@
if ( $force_pack ) {
$user_can_post = 'no';
- $pack_page = get_permalink( wpuf_get_option( 'subscription_page',
- 'wpuf_payment' ) );
+ $pack_page = get_permalink(
+ wpuf_get_option(
+ 'subscription_page',
+ 'wpuf_payment'
+ )
+ );
/* translators: %s: Pack page link */
- $info = sprintf( __( 'You need to <a href="%s">purchase a subscription package</a> to post in this form', 'wp-user-frontend' ), $pack_page );
+ $info = sprintf( __( 'You need to <a href="%s">purchase a subscription package</a> to post in this form', 'wp-user-frontend' ), $pack_page );
} elseif ( $pay_per_post && ! $force_pack ) {
$user_can_post = 'yes';
// $info = sprintf( __( 'There is a <strong>%s</strong> charge to add a new post.', 'wpuf' ), wpuf_format_price( $pay_per_post_cost ));
@@ -224,7 +228,7 @@
// } else {
// $user_can_post = 'yes';
// }
- } else {
+ } else { // phpcs:ignore Universal.ControlStructures.DisallowLonelyIf.Found -- legacy branch, kept as is.
// regular payment checking
if ( $force_pack && is_user_logged_in() ) {
$current_pack = $current_user->subscription()->current_pack();
@@ -233,40 +237,36 @@
// user has valid post count
if ( $has_post_count ) {
$user_can_post = 'yes';
- } else {
- if ( $fallback_enabled && ! $has_post_count ) {
+ } elseif ( $fallback_enabled && ! $has_post_count ) {
$user_can_post = 'yes';
- } else {
- $user_can_post = 'no';
- $info = __( 'Post Limit Exceeded for your purchased subscription pack.', 'wp-user-frontend' );
- }
+ } else {
+ $user_can_post = 'no';
+ $info = __( 'Post Limit Exceeded for your purchased subscription pack.', 'wp-user-frontend' );
}
} else {
$user_can_post = 'no';
$info = $current_pack->get_error_message();
}
- } elseif ( $pay_per_post && is_user_logged_in() && ! $current_user->subscription()->has_post_count( $form_settings['post_type'] ) ) {
+ } elseif ( $pay_per_post && is_user_logged_in() && ! $current_user->subscription()->has_post_count( $form_settings['post_type'] ?? '' ) ) {
$user_can_post = 'yes';
// $info = sprintf( __( 'There is a <strong>%s</strong> charge to add a new post.', 'wpuf' ), wpuf_format_price( $pay_per_post_cost ));
// echo '<div class="wpuf-info">' . apply_filters( 'wpuf_ppp_notice', $info, $id, $form_settings ) . '</div>';
- } elseif ( ! $pay_per_post && ! $current_user->subscription()->has_post_count( $form_settings['post_type'] ) ) {
+ } elseif ( ! $pay_per_post && ! $current_user->subscription()->has_post_count( $form_settings['post_type'] ?? '' ) ) {
$user_can_post = 'no';
$info = sprintf( __( 'Payment type not selected for this form. Please contact admin.', 'wp-user-frontend' ) );
} else {
$user_can_post = 'no';
if ( ! is_user_logged_in() ) {
- $info = $form_settings['message_restrict'];
+ $info = $form_settings['message_restrict'] ?? '';
} else {
$info = sprintf( __( 'Payment type not selected for this form. Please contact admin.', 'wp-user-frontend' ) );
}
}
}
- } else {
- if ( ( isset( $form_settings['post_permission'] ) && 'guest_post' === $form_settings['post_permission'] ) && !
+ } elseif ( ( isset( $form_settings['post_permission'] ) && 'guest_post' === $form_settings['post_permission'] ) && !
is_user_logged_in() ) {
$user_can_post = 'yes';
- }
}
return [ $user_can_post, $info ];
--- a/wp-user-frontend/includes/Admin/Subscription.php
+++ b/wp-user-frontend/includes/Admin/Subscription.php
@@ -214,12 +214,11 @@
* @return void
*/
public function after_registration( $user_id ) {
- if ( isset( $_POST['_wpnonce'] ) && wp_verify_nonce( '_wpnonce' ) ) {
- return;
- }
-
+ // The core register form carries no nonce, so the pack itself is validated below instead.
+ // phpcs:disable WordPress.Security.NonceVerification.Missing
$wpuf_sub = isset( $_POST['wpuf_sub'] ) ? sanitize_text_field( wp_unslash( $_POST['wpuf_sub'] ) ) : '';
$pack_id = isset( $_POST['pack_id'] ) ? intval( wp_unslash( $_POST['pack_id'] ) ) : 0;
+ // phpcs:enable WordPress.Security.NonceVerification.Missing
if ( $wpuf_sub !== 'yes' ) {
return $user_id;
@@ -229,6 +228,11 @@
return $user_id;
}
+ // Only a published pack can be picked at registration; drafts, private and trashed packs are not offered.
+ if ( 'wpuf_subscription' !== get_post_type( $pack_id ) || 'publish' !== get_post_status( $pack_id ) ) {
+ return $user_id;
+ }
+
$pack = $this->get_subscription( $pack_id );
$billing_amount = ( $pack->meta_value['billing_amount'] >= 0 && ! empty( $pack->meta_value['billing_amount'] ) ) ? $pack->meta_value['billing_amount'] : false;
@@ -548,7 +552,8 @@
public static function get_subscription( $sub_id ) {
$pack = get_post( $sub_id );
- if ( ! $pack ) {
+ // Any other post type here would let a non-pack ID be granted or priced as a pack.
+ if ( ! $pack || 'wpuf_subscription' !== $pack->post_type ) {
return false;
}
@@ -611,7 +616,7 @@
$fallback_cost = $form->is_enabled_fallback_cost();
$current_user = wpuf_get_user();
$current_pack = $current_user->subscription()->current_pack();
- $has_post = $current_user->subscription()->has_post_count( $form_settings['post_type'] );
+ $has_post = $current_user->subscription()->has_post_count( $form_settings['post_type'] ?? '' );
if ( $force_pack && ! is_wp_error( $current_pack ) && $has_post ) {
$sub_info = self::get_user_pack( $userdata->ID );
@@ -676,7 +681,7 @@
update_post_meta( $post_id, '_wpuf_order_id', $order_id, true );
}
- if ( $form->is_enabled_pay_per_post() || ( $form->is_enabled_force_pack() && $form->is_enabled_fallback_cost() && ! wpuf_get_user()->subscription()->has_post_count( $form_settings['post_type'] ) ) ) {
+ if ( $form->is_enabled_pay_per_post() || ( $form->is_enabled_force_pack() && $form->is_enabled_fallback_cost() && ! wpuf_get_user()->subscription()->has_post_count( $form_settings['post_type'] ?? '' ) ) ) {
update_post_meta( $post_id, '_wpuf_order_id', $order_id, true );
update_post_meta( $post_id, '_wpuf_payment_status', 'pending' );
}
@@ -702,7 +707,7 @@
$fallback_cost = $form->is_enabled_fallback_cost();
$current_user = wpuf_get_user();
$current_pack = $current_user->subscription()->current_pack();
- $has_pack = $current_user->subscription()->has_post_count( $form_settings['post_type'] );
+ $has_pack = $current_user->subscription()->has_post_count( $form_settings['post_type'] ?? '' );
$ppp_cost_enabled = $form->is_enabled_pay_per_post();
$sub_expired = $current_user->subscription()->expired();
@@ -834,7 +839,7 @@
if ( $form_id ) {
$form_settings = wpuf_get_form_settings( $form_id );
- $post_status = $form_settings['post_status'];
+ $post_status = $form_settings['post_status'] ?? '';
}
$update_post = [
@@ -1139,7 +1144,7 @@
?>
</div>
<?php
- } elseif ( $payment_enabled && $force_pack && $form->is_enabled_fallback_cost() && ! is_wp_error( $current_pack ) && ! $current_user->subscription()->has_post_count( $form_settings['post_type'] ) ) {
+ } elseif ( $payment_enabled && $force_pack && $form->is_enabled_fallback_cost() && ! is_wp_error( $current_pack ) && ! $current_user->subscription()->has_post_count( $form_settings['post_type'] ?? '' ) ) {
?>
<div class="wpuf-info">
<?php
@@ -1271,7 +1276,7 @@
// fallback cost disabled
if ( ! $current_user->subscription()->current_pack_id() ) {
return 'no';
- } elseif ( $current_user->subscription()->has_post_count( $form_settings['post_type'] ) ) {
+ } elseif ( $current_user->subscription()->has_post_count( $form_settings['post_type'] ?? '' ) ) {
return 'yes';
}
} elseif ( $fallback_enabled ) {
--- a/wp-user-frontend/includes/Ajax.php
+++ b/wp-user-frontend/includes/Ajax.php
@@ -38,15 +38,15 @@
$this->register_ajax( 'wpuf_migrate_acf', [ new IntegrationsWPUF_ACF_Compatibility(), 'migrate_cf_data' ], $this->logged_in_only );
$this->register_ajax( 'wpuf_ajax_login', [ new Login_Widget(), 'ajax_login' ], $this->logged_out_only );
$this->register_ajax( 'wpuf_lost_password', [ new Login_Widget(), 'ajax_reset_pass' ], $this->logged_out_only );
- $this->register_ajax( 'wpuf_ajax_logout', [ new Login_Widget(), 'ajax_logout' ], $this->logged_out_only );
+ $this->register_ajax( 'wpuf_ajax_logout', [ new Login_Widget(), 'ajax_logout' ], $this->logged_in_only );
$this->register_ajax( 'wpuf_form_preview', [ new FrontendFrontend_Form(), 'preview_form' ], $this->logged_in_only );
$this->register_ajax( 'wpuf_make_media_embed_code', [ new FrontendFrontend_Form(), 'make_media_embed_code' ] );
$this->register_ajax( 'wpuf_draft_post', [ new FrontendFrontend_Form(), 'draft_post' ] );
$this->register_ajax( 'wpuf_delete_user_package', [ new AdminAdmin_Subscription(), 'delete_user_package' ], $this->logged_in_only );
$this->register_ajax( 'wpuf_address_ajax_action', [ new AjaxAddress_Form_Ajax(), 'ajax_form_action' ] );
$frontend_account = new FrontendFrontend_Account();
- $this->register_ajax( 'wpuf_account_update_profile', [ $frontend_account, 'update_profile' ], $this->logged_in_only );
- $this->register_ajax( 'wpuf_account_change_password', [ $frontend_account, 'change_password' ], $this->logged_in_only );
+ $this->register_ajax( 'wpuf_account_update_profile', [ $frontend_account, 'update_profile' ], $this->logged_in_only );
+ $this->register_ajax( 'wpuf_account_change_password', [ $frontend_account, 'change_password' ], $this->logged_in_only );
$this->register_ajax( 'wpuf_import_forms', [ new AdminAdmin_Tools(), 'import_forms' ], $this->logged_in_only );
$this->register_ajax( 'wpuf_get_child_cat', 'wpuf_get_child_cats' );
$this->register_ajax( 'wpuf_ajax_address', 'wpuf_ajax_get_states_field' );
@@ -76,7 +76,9 @@
'accepted_args' => 1,
];
- $args = wp_parse_args( $default, $args );
+ // Caller args override the defaults (they were swapped, so logged_in_only /
+ // logged_out_only were ignored and every action was registered both ways).
+ $args = wp_parse_args( $args, $default );
if ( $args['priv'] ) {
add_action( 'wp_ajax_' . $action, $callback, $args['priority'], $args['accepted_args'] );
--- a/wp-user-frontend/includes/Ajax/Frontend_Form_Ajax.php
+++ b/wp-user-frontend/includes/Ajax/Frontend_Form_Ajax.php
@@ -121,30 +121,18 @@
}
}
- $protected_shortcodes = wpuf_get_protected_shortcodes();
-
- // check each form field for restricted shortcodes
- foreach ( $this->form_fields as $single_field ) {
- if ( empty( $single_field['name'] ) || empty( $_POST[ $single_field['name'] ] ) || ! is_string( $_POST[ $single_field['name'] ] ) ) {
- continue;
- }
-
- // Check the same text that gets stored: run it through the same
- // wp_kses() pass used on save, then drop control bytes, so the
- // checked copy can not differ from the saved copy.
- $current_data = wpuf_normalize_for_shortcode_check( wp_unslash( $_POST[ $single_field['name'] ] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- normalized and only compared, never stored.
-
- foreach ( $protected_shortcodes as $shortcode ) {
- $search_for = '[' . $shortcode;
- if ( false !== stripos( $current_data, $search_for ) ) {
- wpuf()->ajax->send_error(
- sprintf(
- // translators: %s is shortcode
- __( 'Using %s as shortcode is restricted', 'wp-user-frontend' ), $shortcode
- )
- );
- }
- }
+ // Check every value the submission will store, including fields nested
+ // in columns and post_title / post_content / post_excerpt. The helper
+ // normalizes each value the same way it is normalized on save.
+ $found = wpuf_find_protected_shortcode_in_submission( $this->form_fields );
+
+ if ( ! empty( $found ) ) {
+ wpuf()->ajax->send_error(
+ sprintf(
+ // translators: %s is shortcode
+ __( 'Using %s as shortcode is restricted', 'wp-user-frontend' ), $found
+ )
+ );
}
// Attachment deletion authorization check
@@ -237,7 +225,7 @@
$form_entries = wpuf_form_posts_count( $form_id );
if ( $limit && $limit <= $form_entries ) {
- wpuf()->ajax->send_error( $this->form_settings['limit_message'] );
+ wpuf()->ajax->send_error( $this->form_settings['limit_message'] ?? null );
}
}
$this->on_edit_no_check_recaptcha( $post_vars );
@@ -344,10 +332,10 @@
$postarr['menu_order'] = $menu_order;
}
- if ( $this->form_settings['edit_post_status'] === '_nochange' ) {
+ if ( ( $this->form_settings['edit_post_status'] ?? '' ) === '_nochange' ) {
$postarr['post_status'] = get_post_field( 'post_status', $post_id );
} else {
- $postarr['post_status'] = $this->form_settings['edit_post_status'];
+ $postarr['post_status'] = $this->form_settings['edit_post_status'] ?? '';
}
// handle for falback ppp
if ( 'pending' === get_post_meta( $post_id, '_wpuf_payment_status', true ) ) {
@@ -408,7 +396,7 @@
// Hook for post type specific processing after post creation
if ( $post_id ) {
- do_action( 'wpuf_post_created_' . $this->form_settings['post_type'], $post_id, $postarr, $meta_vars );
+ do_action( 'wpuf_post_created_' . ( $this->form_settings['post_type'] ?? '' ), $post_id, $postarr, $meta_vars );
}
// add post revision when post edit from the frontend
@@ -443,7 +431,7 @@
// save post formats if have any
if ( isset( $this->form_settings['post_format'] ) && $this->form_settings['post_format'] !== '0' ) {
- if ( post_type_supports( $this->form_settings['post_type'], 'post-formats' ) ) {
+ if ( post_type_supports( $this->form_settings['post_type'] ?? '', 'post-formats' ) ) {
set_post_format( $post_id, $this->form_settings['post_format'] );
}
}
@@ -496,11 +484,11 @@
$page_id = isset( $_POST['page_id'] ) ? intval( wp_unslash( $_POST['page_id'] ) ) : '';
if ( $is_update ) {
- if ( $this->form_settings['edit_redirect_to'] === 'page' ) {
- $redirect_to = get_permalink( $this->form_settings['edit_page_id'] );
- } elseif ( $this->form_settings['edit_redirect_to'] === 'url' ) {
- $redirect_to = $this->form_settings['edit_url'];
- } elseif ( $this->form_settings['edit_redirect_to'] === 'same' ) {
+ if ( ( $this->form_settings['edit_redirect_to'] ?? '' ) === 'page' ) {
+ $redirect_to = get_permalink( $this->form_settings['edit_page_id'] ?? '' );
+ } elseif ( ( $this->form_settings['edit_redirect_to'] ?? '' ) === 'url' ) {
+ $redirect_to = $this->form_settings['edit_url'] ?? '';
+ } elseif ( ( $this->form_settings['edit_redirect_to'] ?? '' ) === 'same' ) {
$redirect_to = add_query_arg(
[
'pid' => $post_id,
@@ -512,11 +500,11 @@
} else {
$redirect_to = get_permalink( $post_id );
}
- } elseif ( $this->form_settings['redirect_to'] === 'page' ) {
- $redirect_to = get_permalink( $this->form_settings['page_id'] );
- } elseif ( $this->form_settings['redirect_to'] === 'url' ) {
- $redirect_to = $this->form_settings['url'];
- } elseif ( $this->form_settings['redirect_to'] === 'same' ) {
+ } elseif ( ( $this->form_settings['redirect_to'] ?? '' ) === 'page' ) {
+ $redirect_to = get_permalink( $this->form_settings['page_id'] ?? '' );
+ } elseif ( ( $this->form_settings['redirect_to'] ?? '' ) === 'url' ) {
+ $redirect_to = $this->form_settings['url'] ?? '';
+ } elseif ( ( $this->form_settings['redirect_to'] ?? '' ) === 'same' ) {
$show_message = true;
} else {
$redirect_to = get_permalink( $post_id );
@@ -540,7 +528,7 @@
'success' => true,
'redirect_to' => $redirect_to,
'show_message' => $show_message,
- 'message' => $this->form_settings['message'],
+ 'message' => $this->form_settings['message'] ?? null,
];
$guest_mode = isset( $this->form_settings['post_permission'] ) && 'guest_post' === $this->form_settings['post_permission'] ? $this->form_settings['post_permission'] : '';
@@ -855,10 +843,10 @@
}
// guest post is enabled and details are off
- } elseif ( ( ! empty( $this->form_settings['post_permission'] ) && 'guest_post' === $this->form_settings['post_permission'] ) && ! wpuf_is_checkbox_or_toggle_on( $this->form_settings['guest_details'] ) ) {
+ } elseif ( ( ! empty( $this->form_settings['post_permission'] ) && 'guest_post' === $this->form_settings['post_permission'] ) && ! wpuf_is_checkbox_or_toggle_on( $this->form_settings['guest_details'] ?? '' ) ) {
$post_author = $default_post_author;
} elseif ( ! empty( $this->form_settings['post_permission'] ) && 'guest_post' === $this->form_settings['post_permission'] ) {
- wpuf()->ajax->send_error( $this->form_settings['message_restrict'] );
+ wpuf()->ajax->send_error( $this->form_settings['message_restrict'] ?? null );
}
// the user must be logged in already
--- a/wp-user-frontend/includes/Free/Simple_Login.php
+++ b/wp-user-frontend/includes/Free/Simple_Login.php
@@ -522,6 +522,19 @@
return;
}
+ // Sign-in may only happen for a request that came from a page on this
+ // site. The nonce above cannot establish that: it is printed to every
+ // logged-out visitor, and a cross-site POST carries none of the
+ // visitor's cookies, so this handler would otherwise sign a visitor's
+ // browser into whichever account the other site supplied credentials
+ // for, ending the session they already had. Same cause as
+ // CVE-2026-17564.
+ if ( ! wpuf_is_same_origin_request() ) {
+ $this->login_errors[] = __( 'Permission denied', 'wp-user-frontend' );
+
+ return;
+ }
+
$log = isset( $_POST['log'] ) ? sanitize_text_field( wp_unslash( $_POST['log'] ) ) : '';
$pwd = isset( $_POST['pwd'] ) ? sanitize_text_field( ( wp_unslash( $_POST['pwd'] ) ) ) : '';
// $g_recaptcha_response = isset( $_POST['g-recaptcha-response'] ) ? sanitize_text_field( wp_unslash( $_POST['g-recaptcha-response'] ) ) : '';
@@ -740,8 +753,8 @@
if ( isset( $_POST['user_login'] ) && isset( $_POST['_wpnonce'] ) ) {
$nonce = ! empty( $_POST['_wpnonce'] ) ? sanitize_key( wp_unslash( $_POST['_wpnonce'] ) ) : '';
- if ( ! empty( $nonce) && ! wp_verify_nonce( $nonce, 'wpuf_lost_pass' ) ) {
- return ;
+ if ( ! empty( $nonce ) && ! wp_verify_nonce( $nonce, 'wpuf_lost_pass' ) ) {
+ return;
}
if ( $this->retrieve_password() ) {
--- a/wp-user-frontend/includes/Frontend/Frontend_Form.php
+++ b/wp-user-frontend/includes/Frontend/Frontend_Form.php
@@ -145,7 +145,7 @@
if ( $msg === 'post_updated' ) {
echo wp_kses_post( '<div class="wpuf-success">' );
- echo wp_kses_post( str_replace( '{link}', get_permalink( $post_id ), $this->form_settings['update_message'] ) );
+ echo wp_kses_post( str_replace( '{link}', get_permalink( $post_id ), $this->form_settings['update_message'] ?? '' ) );
echo wp_kses_post( '</div>' );
}
@@ -246,7 +246,7 @@
$allowed_tags = wp_kses_allowed_html( 'post' );
$post_content = isset( $_POST['post_content'] ) ? wp_kses( wp_unslash( $_POST['post_content'] ), $allowed_tags ) : '';
$postarr = [
- 'post_type' => $this->form_settings['post_type'],
+ 'post_type' => $this->form_settings['post_type'] ?? '',
'post_status' => wpuf_get_draft_post_status( $this->form_settings ),
'post_author' => $current_user_id,
'post_title' => isset( $_POST['post_title'] ) ? sanitize_text_field( wp_unslash( $_POST['post_title'] ) ) : '',
@@ -254,6 +254,21 @@
'post_excerpt' => isset( $_POST['post_excerpt'] ) ? wp_kses( wp_unslash( $_POST['post_excerpt'] ), $allowed_tags ) : '',
];
+ // A draft is stored with wp_insert_post() just like a submission, so it has to
+ // pass the same protected-shortcode check submit_post() applies, over the same
+ // fields. Without it the draft endpoint stores a shortcode the submission
+ // endpoint rejects.
+ $protected_shortcode = wpuf_find_protected_shortcode_in_submission( $this->form_fields );
+
+ if ( ! empty( $protected_shortcode ) ) {
+ wp_send_json_error(
+ [
+ /* translators: %s: the protected shortcode name */
+ 'message' => sprintf( __( 'Using %s as shortcode is restricted', 'wp-user-frontend' ), $protected_shortcode ),
+ ]
+ );
+ }
+
if ( ! empty( $this->form_fields ) ) {
foreach ( $this->form_fields as $field ) {
if ( $field['template'] === 'taxonomy' ) {
@@ -335,7 +350,7 @@
// save post formats if have any
if ( isset( $this->form_settings['post_format'] ) && $this->form_settings['post_format'] !== '0' ) {
- if ( post_type_supports( $this->form_settings['post_type'], 'post-formats' ) ) {
+ if ( post_type_supports( $this->form_settings['post_type'] ?? '', 'post-formats' ) ) {
set_post_format( $post_id, $this->form_settings['post_format'] );
}
}
@@ -637,7 +652,7 @@
$replace = [ "<a href='" . $login . "'>Login</a>", "<a href='" . $register . "'>Register</a>" ];
$placeholders = [ '{login}', '{register}' ];
- $this->form_settings['message_restrict'] = str_replace( $placeholders, $replace, $this->form_settings['message_restrict'] );
+ $this->form_settings['message_restrict'] = str_replace( $placeholders, $replace, $this->form_settings['message_restrict'] ?? '' );
}
}
--- a/wp-user-frontend/includes/Frontend/Payment.php
+++ b/wp-user-frontend/includes/Frontend/Payment.php
@@ -136,7 +136,8 @@
return;
}
$recurring_pay = isset( $pack_detail->meta_value['recurring_pay'] ) ? $pack_detail->meta_value['recurring_pay'] : 'no';
- if ( empty( $pack_detail->meta_value['billing_amount'] ) || $pack_detail->meta_value['billing_amount'] <= 0 ) {
+ // A free pack is only given away while it is published; drafts, private and trashed packs are not offered.
+ if ( ( empty( $pack_detail->meta_value['billing_amount'] ) || $pack_detail->meta_value['billing_amount'] <= 0 ) && 'publish' === $pack_detail->post_status ) {
$is_free = true;
}
}
@@ -564,7 +565,7 @@
$form_settings = $form->get_settings();
$force_pack = $form->is_enabled_force_pack();
$fallback_on = $form->is_enabled_fallback_cost();
- $post_count = $current_user->subscription()->has_post_count( $form_settings['post_type'] );
+ $post_count = $current_user->subscription()->has_post_count( $form_settings['post_type'] ?? '' );
if ( $force_pack && $fallback_on && ! is_wp_error( $current_pack ) && ! $post_count ) {
$amount = $form->get_subs_fallback_cost();
} else {
--- a/wp-user-frontend/includes/Frontend/Registration.php
+++ b/wp-user-frontend/includes/Frontend/Registration.php
@@ -418,7 +418,24 @@
);
}
$autologin_after_registration = wpuf_get_option( 'autologin_after_registration', 'wpuf_profile', 'on' );
- if ( $autologin_after_registration === 'on' ) {
+
+ // Autologin may only run when the submission came from a page on this
+ // site, which is the one thing that ties the request to the browser
+ // that is about to receive the cookie. The nonce cannot: on a
+ // logged-out-only template it is minted at user id 0 with an empty
+ // session token, so every anonymous visitor is served the same value
+ // and anyone can embed it in a cross-site form. is_user_logged_in()
+ // above cannot either: a cross-site POST sends no cookies under the
+ // SameSite=Lax default, so it reads as a logged-out request while the
+ // response still lands in the victim's browser, clearing their session
+ // and logging them into the account just created.
+ //
+ // The registration itself is unaffected: a submission we cannot
+ // attribute to this browser still creates the account, it just does
+ // not get an authentication cookie.
+ //
+ // CVE-2026-17564, reported by Yaswanth Reddy Sunkara.
+ if ( $autologin_after_registration === 'on' && wpuf_is_same_origin_request() ) {
wp_clear_auth_cookie();
wp_set_current_user( $user );
wp_set_auth_cookie( $user );
--- a/wp-user-frontend/includes/Frontend_Render_Form.php
+++ b/wp-user-frontend/includes/Frontend_Render_Form.php
@@ -94,7 +94,7 @@
?>
<li class="el-name">
<div class="wpuf-label">
- <label><?php echo esc_html( $form_settings['name_label'] ); ?> <span class="required">*</span></label>
+ <label><?php echo esc_html( $form_settings['name_label'] ?? '' ); ?> <span class="required">*</span></label>
</div>
<div class="wpuf-fields">
@@ -104,7 +104,7 @@
<li class="el-email">
<div class="wpuf-label">
- <label><?php echo esc_html( $form_settings['email_label'] ); ?> <span class="required">*</span></label>
+ <label><?php echo esc_html( $form_settings['email_label'] ?? '' ); ?> <span class="required">*</span></label>
</div>
<div class="wpuf-fields">
@@ -266,7 +266,7 @@
$replace = [ "<a href='" . $login . "'>Login</a>", "<a href='" . $register . "'>Register</a>" ];
$placeholders = [ '{login}', '{register}' ];
- $message_restrict = str_replace( $placeholders, $replace, $this->form_settings['message_restrict'] );
+ $message_restrict = str_replace( $placeholders, $replace, $this->form_settings['message_restrict'] ?? '' );
echo wp_kses_post( '<div class="wpuf-message">' . $message_restrict . '</div>' );
--- a/wp-user-frontend/includes/Integrations/Events_Calendar/Compatibility/TEC_V6_Compatibility.php
+++ b/wp-user-frontend/includes/Integrations/Events_Calendar/Compatibility/TEC_V6_Compatibility.php
@@ -28,20 +28,22 @@
$all_data = array_merge( $form_data, $meta_vars );
// Extract taxonomy data directly from $_POST since WPUF doesn't pass it in form_data
+ // phpcs:disable WordPress.Security.NonceVerification.Missing -- runs inside the WPUF submit handler, after its nonce check.
// Check for tribe_events_cat taxonomy field - can be array of IDs or comma-separated string
if ( isset( $_POST['tribe_events_cat'] ) && ! isset( $all_data['tribe_events_cat'] ) ) {
if ( is_array( $_POST['tribe_events_cat'] ) ) {
- $all_data['tribe_events_cat'] = array_map( 'intval', $_POST['tribe_events_cat'] );
+ $all_data['tribe_events_cat'] = array_map( 'intval', wp_unslash( $_POST['tribe_events_cat'] ) );
} else {
// Could be comma-separated string of IDs or names
- $all_data['tribe_events_cat'] = sanitize_text_field( $_POST['tribe_events_cat'] );
+ $all_data['tribe_events_cat'] = sanitize_text_field( wp_unslash( $_POST['tribe_events_cat'] ) );
}
}
// Check for tags if not already in form_data
if ( ! isset( $all_data['tags'] ) && ! isset( $all_data['tags_input'] ) && isset( $_POST['tags'] ) ) {
- $all_data['tags'] = sanitize_text_field( $_POST['tags'] );
+ $all_data['tags'] = sanitize_text_field( wp_unslash( $_POST['tags'] ) );
}
+ // phpcs:enable WordPress.Security.NonceVerification.Missing
/**
* Opportunity to modify form data before converting to TEC ORM format
@@ -102,7 +104,7 @@
} else {
return false;
}
- } else {
+ } else { // phpcs:ignore Universal.ControlStructures.DisallowLonelyIf.Found -- legacy branch, kept as is.
// Fallback: create a default end date if none provided
if ( ! empty( $orm_args['start_date'] ) ) {
$start_datetime = new DateTime( $orm_args['start_date'] );
@@ -138,7 +140,7 @@
}
// Handle all-day events using ORM field alias
if ( ! empty( $all_data['_EventAllDay'] ) ) {
- $is_all_day = is_array( $all_data['_EventAllDay'] ) && in_array( '1', $all_data['_EventAllDay'] );
+ $is_all_day = is_array( $all_data['_EventAllDay'] ) && in_array( '1', array_map( 'strval', $all_data['_EventAllDay'] ), true );
$orm_args['all_day'] = $is_all_day;
// For all-day events, if no end date is provided, set it to the same day
if ( $is_all_day && ! empty( $orm_args['start_date'] ) && empty( $orm_args['end_date'] ) ) {
@@ -181,7 +183,7 @@
if ( ! empty( $all_data['_EventTimezone'] ) ) {
$timezone = sanitize_text_field( $all_data['_EventTimezone'] );
// Validate timezone
- if ( in_array( $timezone, timezone_identifiers_list() ) ) {
+ if ( in_array( $timezone, timezone_identifiers_list(), true ) ) {
$orm_args['timezone'] = $timezone;
} else {
// Use default timezone as fallback
@@ -192,7 +194,7 @@
$orm_args['timezone'] = wp_timezone_string();
}
// Ensure timezone is valid for TEC
- if ( ! in_array( $orm_args['timezone'], timezone_identifiers_list() ) ) {
+ if ( ! in_array( $orm_args['timezone'], timezone_identifiers_list(), true ) ) {
$orm_args['timezone'] = 'UTC';
}
// Map URL field using ORM field alias
@@ -206,20 +208,20 @@
// Map presentation fields using ORM field aliases
if ( ! empty( $all_data['_EventShowMap'] ) ) {
$show_map = is_array( $all_data['_EventShowMap'] ) && in_array(
- '1', $all_data['_EventShowMap']
- );
+ '1', array_map( 'strval', $all_data['_EventShowMap'] ), true
+ );
$orm_args['show_map'] = $show_map;
}
if ( ! empty( $all_data['_EventShowMapLink'] ) ) {
$show_map_link = is_array( $all_data['_EventShowMapLink'] ) && in_array(
- '1', $all_data['_EventShowMapLink']
- );
+ '1', array_map( 'strval', $all_data['_EventShowMapLink'] ), true
+ );
$orm_args['show_map_link'] = $show_map_link;
}
if ( ! empty( $all_data['_EventHideFromUpcoming'] ) ) {
$hide_from_upcoming = is_array( $all_data['_EventHideFromUpcoming'] ) && in_array(
- '1', $all_data['_EventHideFromUpcoming']
- );
+ '1', array_map( 'strval', $all_data['_EventHideFromUpcoming'] ), true
+ );
$orm_args['hide_from_upcoming'] = $hide_from_upcoming;
}
// Map duration if available
@@ -237,7 +239,7 @@
// Convert comma-separated string to array
$tags = array_map( 'trim', explode( ',', $all_data['tags'] ) );
$orm_args['tags_input'] = $tags;
- } else if ( is_array( $all_data['tags'] ) ) {
+ } elseif ( is_array( $all_data['tags'] ) ) {
$orm_args['tags_input'] = $all_data['tags'];
}
}
@@ -247,7 +249,7 @@
// Handle different formats - could be array of IDs, comma-separated string, or text
if ( is_array( $all_data['tribe_events_cat'] ) ) {
$orm_args['categories'] = $all_data['tribe_events_cat'];
- } else if ( is_string( $all_data['tribe_events_cat'] ) ) {
+ } elseif ( is_string( $all_data['tribe_events_cat'] ) ) {
// Check if it's comma-separated IDs or names
if ( preg_match( '/^d+(,d+)*$/', $all_data['tribe_events_cat'] ) ) {
// Comma-separated IDs
@@ -372,11 +374,11 @@
}
}
// Check for WPUF nonce
- if ( isset( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'wpuf_form_add' ) ) {
+ if ( isset( $_POST['_wpnonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ), 'wpuf_form_add' ) ) {
return true;
}
// Check for WPUF AJAX action
- if ( isset( $_POST['action'] ) && strpos( $_POST['action'], 'wpuf' ) === 0 ) {
+ if ( isset( $_POST['action'] ) && strpos( sanitize_text_field( wp_unslash( $_POST['action'] ) ), 'wpuf' ) === 0 ) {
return true;
}
@@ -395,7 +397,7 @@
* @return bool
*/
public function prepare_event_data( $form_id, $form_settings, $form_data ) {
- if ( $form_settings['post_type'] !== 'tribe_events' ) {
+ if ( ( $form_settings['post_type'] ?? '' ) !== 'tribe_events' ) {
return true;
}
// Convert form data to ORM format
--- a/wp-user-frontend/includes/Integrations/WPUF_ACF_Compatibility.php
+++ b/wp-user-frontend/includes/Integrations/WPUF_ACF_Compatibility.php
@@ -100,7 +100,7 @@
$form_id = $form->ID;
$form_vars = wpuf_get_form_fields( $form_id );
$form_settings = wpuf_get_form_settings( $form_id );
- $post_type = $form_settings['post_type'];
+ $post_type = $form_settings['post_type'] ?? '';
foreach ( $form_vars as $attr ) {
$field_type = $attr['input_type'];
$meta = $attr['is_meta'];
@@ -143,7 +143,7 @@
'post_status' => 'publish',
];
- return $form_posts = get_posts( $args );
+ return get_posts( $args );
}
/**
@@ -177,31 +177,83 @@
return;
} ?>
<div class="notice notice-info">
- <p><strong><?php printf(
+ <p><strong>
+ <?php
+ printf(
// translators: %s is Title
esc_html( __( '%s Detected', 'wp-user-frontend' ) ),
- esc_html( $this->title ) ); ?></strong></p>
- <p><?php printf( wp_kses_post(
+ esc_html( $this->title )
+ );
+ ?>
+ </strong></p>
+ <p>
+ <?php
+ printf(
+ wp_kses_post(
// translators: %s is Title
- __( 'Hey, looks like you have <strong>%s</strong> installed. What do you want to do with WPUF?',
- 'wp-user-frontend' ) ), esc_html( $this->title ) ); ?></p>
+ __(
+ 'Hey, looks like you have <strong>%s</strong> installed. What do you want to do with WPUF?',
+ 'wp-user-frontend'
+ )
+ ), esc_html( $this->title )
+ );
+ ?>
+ </p>
<p><i><strong
- style="color:#46b450;">Compatible: </strong><?php printf( esc_html( __( 'It will update compatibility option only, so existing custom fields data format will not change.',
- 'wp-user-frontend' ) ) ); ?></i></p>
+ style="color:#46b450;">Compatible: </strong>
+ <?php
+ printf(
+ esc_html(
+ __(
+ 'It will update compatibility option only, so existing custom fields data format will not change.',
+ 'wp-user-frontend'
+ )
+ )
+ );
+ ?>
+ </i></p>
<p><i><strong style="color:#46b450;">Compatible &
- Migrate: </strong><?php printf( esc_html( __( 'It will update existing custom fields data to ACF format and update compatibility option too.',
- 'wp-user-frontend' ) ) ); ?></i></p>
+ Migrate: </strong>
+ <?php
+ printf(
+ esc_html(
+ __(
+ 'It will update existing custom fields data to ACF format and update compatibility option too.',
+ 'wp-user-frontend'
+ )
+ )
+ );
+ ?>
+ </i></p>
<p>
<a href="#" class="button button-primary"
- id="wpuf-compatible-<?php echo esc_attr( $this->id ); ?>"><?php esc_html_e( 'Compatible',
- 'wp-user-frontend' ); ?></a>
+ id="wpuf-compatible-<?php echo esc_attr( $this->id ); ?>">
+ <?php
+ esc_html_e(
+ 'Compatible',
+ 'wp-user-frontend'
+ );
+ ?>
+ </a>
<a href="#" class="button button-primary"
- id="wpuf-migrate-<?php echo esc_attr( $this->id ); ?>"><?php esc_html_e( 'Compatible & Migrate',
- 'wp-user-frontend' ); ?></a>
+ id="wpuf-migrate-<?php echo esc_attr( $this->id ); ?>">
+ <?php
+ esc_html_e(
+ 'Compatible & Migrate',
+ 'wp-user-frontend'
+ );
+ ?>
+ </a>
<a href="#" class="button"
- id="wpuf-dismiss-<?php echo esc_attr( $this->id ); ?>"><?php esc_html_e( 'No Thanks',
- 'wp-user-frontend' ); ?></a>
+ id="wpuf-dismiss-<?php echo esc_attr( $this->id ); ?>">
+ <?php
+ esc_html_e(
+ 'No Thanks',
+ 'wp-user-frontend'
+ );
+ ?>
+ </a>
</p>
</div>
@@ -315,7 +367,7 @@
if ( ! $this->plugin_exists() ) {
return;
}
- $groups = acf_get_field_groups( [ 'post_type' => $form_settings['post_type'] ] );
+ $groups = acf_get_field_groups( [ 'post_type' => $form_settings['post_type'] ?? null ] );
$existing_meta = get_post_meta( $post_id );
foreach ( acf_get_fields( $groups ) as $group ) {
$meta_key = '_' . $group['name'];
@@ -325,9 +377,11 @@
$meta_key = 'repeater';
}
//check key also in meta vars
- $meta_keys = array_map( function( $meta_var ) {
- return $meta_var['name'];
- }, $meta_vars );
+ $meta_keys = array_map(
+ function ( $meta_var ) {
+ return $meta_var['name'];
+ }, $meta_vars
+ );
if ( ! array_key_exists( $meta_key, $existing_meta ) && in_array( $name, $meta_keys, true ) ) {
update_post_meta( $post_id, $meta_key, $group['key'] );
}
--- a/wp-user-frontend/includes/Integrations/WPUF_WCMp_Integration.php
+++ b/wp-user-frontend/includes/Integrations/WPUF_WCMp_Integration.php
@@ -17,8 +17,10 @@
add_filter( 'wcmp_vendor_dashboard_nav', [ $this, 'add_wpuf_posts_page' ] );
add_filter( 'wcmp_endpoints_query_vars', [ $this, 'add_query_var' ] );
add_filter( 'settings_vendor_general_tab_new_input', [ $this, 'endpoint_option_fields_sanitize' ], 10, 2 );
- add_action( 'wcmp_vendor_dashboard_submit-post_endpoint',
- [ $this, 'wcmp_vendor_dashboard_submit_post_endpoint' ] );
+ add_action(
+ 'wcmp_vendor_dashboard_submit-post_endpoint',
+ [ $this, 'wcmp_vendor_dashboard_submit_post_endpoint' ]
+ );
add_filter( 'wpuf_edit_post_link', [ $this, 'generate_edit_post_link' ] );
add_filter( 'wpuf_edit_post_redirect', [ $this, 'update_edit_post_redirect_url' ], 10, 4 );
add_filter( 'wpuf_delete_post_redirect', [ $this, 'update_delete_post_redirect_url' ] );
@@ -49,8 +51,12 @@
'id' => 'wpuf_post_forms',
'name' => 'wpuf_post_forms',
'label_for' => 'wpuf_post_forms',
- 'desc' => stripslashes( __( 'Select a post form that will show on the vendor dashboard.',
- 'wp-user-frontend' ) ),
+ 'desc' => stripslashes(
+ __(
+ 'Select a post form that will show on the vendor dashboard.',
+ 'wp-user-frontend'
+ )
+ ),
'options' => $this->get_post_forms(),
];
@@ -126,8 +132,12 @@
public function add_wpuf_posts_page( $vendor_nav ) {
$vendor_nav['submit-post'] = [
'label' => __( 'Submit Post', 'wp-user-frontend' ),
- 'url' => wcmp_get_vendor_dashboard_endpoint_url( get_wcmp_vendor_settings( 'wcmp_vendor_submit_post_endpoint',
- 'vendor', 'general', 'submit-post' ) ),
+ 'url' => wcmp_get_vendor_dashboard_endpoint_url(
+ get_wcmp_vendor_settings(
+ 'wcmp_vendor_submit_post_endpoint',
+ 'vendor', 'general', 'submit-post'
+ )
+ ),
'capability' => apply_filters( 'wcmp_vendor_dashboard_menu_vendor_submit_post_capability', true ),
'position' => 90,
'submenu' => [],
@@ -144,8 +154,10 @@
public function add_query_var( $query_vars ) {
$query_vars['submit-post'] = [
'label' => __( 'Submit Post', 'wp-user-frontend' ),
- 'endpoint' => get_wcmp_vendor_settings( 'wcmp_vendor_submit_post_endpoint', 'vendor', 'general',
- 'submit-post' ),
+ 'endpoint' => get_wcmp_vendor_settings(
+ 'wcmp_vendor_submit_post_endpoint', 'vendor', 'general',
+ 'submit-post'
+ ),
];
return $query_vars;
@@ -190,13 +202,19 @@
*/
public function generate_edit_post_link( $url ) {
global $post;
- $posts_page_url = wcmp_get_vendor_dashboard_endpoint_url( get_wcmp_vendor_settings( 'wcmp_vendor_submit_post_endpoint',
- 'vendor', 'general', 'submit-post' ) );
+ $posts_page_url = wcmp_get_vendor_dashboard_endpoint_url(
+ get_wcmp_vendor_settings(
+ 'wcmp_vendor_submit_post_endpoint',
+ 'vendor', 'general', 'submit-post'
+ )
+ );
if ( is_vendor_dashboard() ) {
- $url = add_query_arg( [
- 'action' => 'edit-post',
- 'pid' => $post->ID,
- ], $posts_page_url );
+ $url = add_query_arg(
+ [
+ 'action' => 'edit-post',
+ 'pid' => $post->ID,
+ ], $posts_page_url
+ );
}
return $url;
@@ -208,17 +226,25 @@
public function update_edit_post_redirect_url( $response, $post_id, $form_id, $form_settings ) {
$user = wp_get_current_user();
$role = (array) $user->roles;
- $selected_form = ( get_wcmp_vendor_settings( 'wpuf_post_forms',
- 'general' ) ) ? get_wcmp_vendor_settings( 'wpuf_post_forms', 'general' ) : '';
- if ( $role[0] === 'dc_vendor' && $form_id === $selected_form && $form_settings['edit_redirect_to'] === 'same' ) {
- $post_page_url = wcmp_get_vendor_dashboard_endpoint_url( get_wcmp_vendor_settings( 'wcmp_vendor_submit_post_endpoint',
- 'vendor', 'general', 'submit-post' ) );
- $redirect_url = add_query_arg( [
- 'action' => 'edit-post',
- 'pid' => $post_id,
- '_wpnonce' => wp_create_nonce( 'wpuf_edit' ),
- 'msg' => 'post_updated',
- ], $post_page_url );
+ $selected_form = ( get_wcmp_vendor_settings(
+ 'wpuf_post_forms',
+ 'general'
+ ) ) ? get_wcmp_vendor_settings( 'wpuf_post_forms', 'general' ) : '';
+ if ( $role[0] === 'dc_vendor' && $form_id === $selected_form && ( $form_settings['edit_redirect_to'] ?? '' ) === 'same' ) {
+ $post_page_url = wcmp_get_vendor_dashboard_endpoint_url(
+ get_wcmp_vendor_settings(
+ 'wcmp_vendor_submit_post_endpoint',
+ 'vendor', 'general', 'submit-post'
+ )
+ );
+ $redirect_url = add_query_arg(
+ [
+ 'action' => 'edit-post',
+ 'pid' => $post_id,
+ '_wpnonce' => wp_create_nonce( 'wpuf_edit' ),
+ 'msg' => 'post_updated',
+ ], $post_page_url
+ );
$response['redirect_to'] = $redirect_url;
}
@@ -230,11 +256,17 @@
*/
public function update_delete_post_redirect_url( $redirect_url ) {
if ( is_vendor_dashboard() ) {
- $post_page_url = wcmp_get_vendor_dashboard_endpoint_url( get_wcmp_vendor_settings( 'wcmp_vendor_submit_post_endpoint',
- 'vendor', 'general', 'submit-post' ) );
- $redirect_url = add_query_arg( [
- 'msg' => 'deleted',
- ], $post_page_url );
+ $post_page_url = wcmp_get_vendor_dashboard_endpoint_url(
+ get_wcmp_vendor_settings(
+ 'wcmp_vendor_submit_post_endpoint',
+ 'vendor', 'general', 'submit-post'
+ )
+ );
+ $redirect_url = add_query_arg(
+ [
+ 'msg' => 'deleted',
+ ], $post_page_url
+ );
}
return $redirect_url;
--- a/wp-user-frontend/includes/Integrations/WPUF_WC_Vendors_Integration.php
+++ b/wp-user-frontend/includes/Integrations/WPUF_WC_Vendors_Integration.php
@@ -92,9 +92,11 @@
$allow_wpuf_post = get_option( 'allow_wcvendors_wpuf_post', 'no' );
if ( $allow_wpuf_post === 'yes' ) {
$dashboard_url = get_permalink( get_option( 'wcvendors_vendor_dashboard_page_id' ) );
- $post_page_url = add_query_arg( [
- 'action' => 'post-listing',
- ], $dashboard_url );
+ $post_page_url = add_query_arg(
+ [
+ 'action' => 'post-listing',
+ ], $dashboard_url
+ );
$output = '<a href="' . $post_page_url . '" class="button">';
$output .= __( 'Posts', 'wp-user-frontend' );
$output .= '</a>';
@@ -167,10 +169,12 @@
global $post;
$posts_page_url = get_permalink( get_option( 'wcvendors_vendor_dashboard_page_id' ) );
if ( is_page( get_option( 'wcvendors_vendor_dashboard_page_id' ) ) ) {
- $url = add_query_arg( [
- 'action' => 'edit-post',
- 'pid' => $post->ID,
- ], $posts_page_url );
+ $url = add_query_arg(
+ [
+ 'action' => 'edit-post',
+ 'pid' => $post->ID,
+ ], $posts_page_url
+ );
}
return $url;
@@ -183,14 +187,16 @@
$user = wp_get_current_user();
$role = (array) $user->roles;
$selected_form = get_option( 'wcvendors_wpuf_allowed_post_form', '' );
- if ( $role[0] === 'vendor' && $form_id === $selected_form && $form_settings['edit_redirect_to'] === 'same' ) {
+ if ( $role[0] === 'vendor' && $form_id === $selected_form && ( $form_settings['edit_redirect_to'] ?? '' ) === 'same' ) {
$post_page_url = get_permalink( get_option( 'wcvendors_vendor_dashboard_page_id' ) );
- $redirect_url = add_query_arg( [
- 'action' => 'edit-post',
- 'pid' => $post_id,
- '_wpnonce' => wp_create_nonce( 'wpuf_edit' ),
- 'msg' => 'post_updated',
- ], $post_page_url );
+ $redirect_url = add_query_arg(
+ [
+ 'action' => 'edit-post',
+ 'pid' => $post_id,
+ '_wpnonce' => wp_create_nonce( 'wpuf_edit' ),
+ 'msg' => 'post_updated',
+ ], $post_page_url
+ );
$response['redirect_to'] = $redirect_url;
}
@@ -203,10 +209,12 @@
public function update_delete_post_redirect_url( $redirect_url ) {
if ( is_page( get_option( 'wcvendors_vendor_dashboard_page_id' ) ) ) {
$post_page_url = get_permalink( get_option( 'wcvendors_vendor_dashboard_page_id' ) );
- $redirect_url = add_query_arg( [
- 'action' => 'post-listing',
- 'msg' => 'deleted',
- ], $post_page_url );
+ $redirect_url = add_query_arg(
+ [
+ 'action' => 'post-listing',
+ 'msg' => 'deleted',
+ ], $post_page_url
+ );
}
return $redirect_url;
--- a/wp-user-frontend/includes/Traits/FieldableTrait.php
+++ b/wp-user-frontend/includes/Traits/FieldableTrait.php
@@ -154,7 +154,7 @@
}
public function set_default_taxonomy( $post_id ) {
- $post_taxonomies = get_object_taxonomies( $this->form_settings['post_type'], 'objects' );
+ $post_taxonomies = get_object_taxonomies( $this->form_settings['post_type'] ?? '', 'objects' );
foreach ( $post_taxonomies as $tax ) {
if ( $tax->hierarchical ) {
$name = 'default_' . $tax->name;
@@ -768,27 +768,27 @@
// At this point $taxonomy_name should be a single id or array of ids
if ( isset( $taxonomy_name ) && $taxonomy_name != 0 && $taxonomy_name != -1 ) {
// Auto-register post_tag taxonomy for tribe_events if not already registered
- if ( 'tribe_events' === $this->form_settings['post_type'] &&
+ if ( 'tribe_events' === ( $this->form_settings['post_type'] ?? '' ) &&
'post_tag' === $taxonomy['name'] &&
! is_object_in_taxonomy( $this->form_settings['post_type'], $taxonomy['name'] ) ) {
register_taxonomy_for_object_type( 'post_tag', 'tribe_events' );
}
// Auto-register product_tag taxonomy for product if not already registered
- if ( 'product' === $this->form_settings['post_type'] &&
+ if ( 'product' === ( $this->form_settings['post_type'] ?? '' ) &&
'product_tag' === $taxonomy['name'] &&
- ! is_object_in_taxonomy( $this->form_settings['post_type'], $taxonomy['name'] ) ) {
+ ! is_object_in_taxonomy( $this->form_settings['post_type'] ?? '', $taxonomy['name'] ) ) {
register_taxonomy_for_object_type( 'product_tag', 'product' );
}
// Auto-register download_tag taxonomy for download if not already registered
- if ( 'download' === $this->form_settings['post_type'] &&
+ if ( 'download' === ( $this->form_settings['post_type'] ?? '' ) &&
'download_tag' === $taxonomy['name'] &&
- ! is_object_in_taxonomy( $this->form_settings['post_type'], $taxonomy['name'] ) ) {
+ ! is_object_in_taxonomy( $this->form_settings['post_type'] ?? '', $taxonomy['name'] ) ) {
register_taxonomy_for_object_type( 'download_tag', 'download' );
}
- if ( is_object_in_taxonomy( $this->form_settings['post_type'], $taxonomy['name'] ) ) {
+ if ( is_object_in_taxonomy( $this->form_settings['post_type'] ?? '', $taxonomy['name'] ) ) {
$tax = $taxonomy_name;
// if it's not an array, make it one
if ( ! is_array( $tax ) ) {
--- a/wp-user-frontend/includes/Widgets/Login_Widget.php
+++ b/wp-user-frontend/includes/Widgets/Login_Widget.php
@@ -17,8 +17,8 @@
parent::__construct(
'Login_Widget',
__( 'WPUF Ajax Login', 'wp-user-frontend' ),
- [ 'description' => __( 'Ajax Login widget for WP User Frontend', 'wp-user-frontend' )]
- );
+ [ 'description' => __( 'Ajax Login widget for WP User Frontend', 'wp-user-frontend' ) ]
+ );
}
/**
@@ -32,19 +32,34 @@
$rememberme = isset( $_POST['rememberme'] ) ? sanitize_text_field( wp_unslash( $_POST['rememberme'] ) ) : false;
$nonce = isset( $_REQUEST['_wpnonce'] ) ? sanitize_key( wp_unslash( $_REQUEST['_wpnonce'] ) ) : '';
- if ( empty( $nonce ) || ! wp_verify_nonce( $nonce , 'wpuf_lost_pass' ) ) {
+ if ( empty( $nonce ) || ! wp_verify_nonce( $nonce, 'wpuf_lost_pass' ) ) {
+ wp_send_json_error( __( 'Permission denied', 'wp-user-frontend' ) );
+ }
+
+ // Sign-in may only happen for a request that came from a page on this
+ // site. The nonce above cannot establish that: it is printed to every
+ // logged-out visitor, and a cross-site POST carries none of the
+ // visitor's cookies, so this nopriv handler would otherwise sign a
+ // visitor's browser into whichever account the other site chose,
+ // ending the session they had. Same cause as CVE-2026-17564.
+ if ( ! wpuf_is_same_origin_request() ) {
wp_send_json_error( __( 'Permission denied', 'wp-user-frontend' ) );
}
if ( empty( $user_login ) || empty( $user_pass ) ) {
- wp_send_json_error( [ 'message'=> __( 'Please fill all form fields', 'wp-user-frontend' ) ] );
+ wp_send_json_error( [ 'message' => __( 'Please fill all form fields', 'wp-user-frontend' ) ] );
} else {
- $user = wp_signon( ['user_login' => $user_login, 'user_password' => $user_pass], false );
+ $user = wp_signon(
+ [
+ 'user_login' => $user_login,
+ 'user_password' => $user_pass,
+ ], false
+ );
if ( is_wp_error( $user ) ) {
- wp_send_json_error( [ 'message'=> $user->get_error_message() ] );
+ wp_send_json_error( [ 'message' => $user->get_error_message() ] );
} else {
- wp_send_json_success( [ 'message'=> __( 'Login successful!', 'wp-user-frontend' ) ] );
+ wp_send_json_success( [ 'message' => __( 'Login successful!', 'wp-user-frontend' ) ] );
}
}
wp_set_auth_cookie( $user->ID, $rememberme );
@@ -63,7 +78,7 @@
}
wp_logout();
- wp_send_json_success( [ 'message'=> __( 'Logout successful!', 'wp-user-frontend' ) ] );
+ wp_send_json_success( [ 'message' => __( 'Logout successful!', 'wp-user-frontend' ) ] );
}
/**
@@ -81,7 +96,12 @@
// Check if inp