Skip to content

Commit 81a63d7

Browse files
author
hCaptcha GHA
committed
Add compatibility with the UsersWP plugin v1.2.28.
1 parent cd5b3b1 commit 81a63d7

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,7 @@ Instructions for popular native integrations are below:
628628
== Changelog ==
629629

630630
= 4.11.0 =
631+
* Added compatibility with the UsersWP plugin v1.2.28.
631632
* Fixed processing wpDiscuz comment form with wpDiscuz custom ajax.
632633
* Fixed adding hCaptcha internal fields to Avada from submission.
633634

src/php/UsersWP/Register.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,24 +79,19 @@ public function uwp_template_after( string $name ): void {
7979

8080
$template = (string) ob_get_clean();
8181

82-
ob_start();
83-
84-
$args = [
82+
$args = [
8583
'action' => static::ACTION,
8684
'name' => static::NONCE,
8785
'id' => [
8886
'source' => HCaptcha::get_class_source( static::class ),
8987
'form_id' => 'register',
9088
],
9189
];
92-
93-
HCaptcha::form_display( $args );
94-
95-
$captcha = (string) ob_get_clean();
96-
$search = '<input type="submit"';
90+
$hcaptcha = HCaptcha::form( $args );
91+
$search = '/(<(?:input|button) type="submit")/';
9792

9893
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
99-
echo str_replace( $search, $captcha . $search, $template );
94+
echo preg_replace( $search, $hcaptcha . '$1', $template );
10095
}
10196

10297
/**

0 commit comments

Comments
 (0)