Skip to content

Commit cbfddb9

Browse files
committed
🐛 Fix bug with user_email and user_url mapping
1 parent 9aa0c99 commit cbfddb9

File tree

5 files changed

+27
-23
lines changed

5 files changed

+27
-23
lines changed

inc/class-wp-rainbow-login-functionality.php

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -303,24 +303,26 @@ function ( $err, $balance ) use ( $wp_rainbow_options ) {
303303

304304
$user_attributes_mapping = $wp_rainbow->get_parsed_user_attributes_mapping();
305305
foreach ( $user_attributes_mapping as $mapping ) {
306-
if ( isset( $attributes[ $mapping[0] ] ) ) {
307-
if ( in_array(
308-
$mapping[1],
309-
[
310-
'user_email',
311-
'user_url',
312-
],
313-
true
314-
) ) {
315-
wp_update_user(
306+
if ( is_array( $mapping ) && ! empty( $mapping[0] ) && ! empty( $mapping[1] ) ) {
307+
if ( isset( $attributes[ $mapping[0] ] ) ) {
308+
if ( in_array(
309+
$mapping[1],
316310
[
317-
'ID' => $user->ID,
318-
$mapping[1] => $attributes[ $mapping[0] ],
319-
]
320-
);
321-
} else {
322-
update_user_meta( $user->ID, $mapping[1], $attributes[ $mapping[0] ] );
323-
311+
'user_email',
312+
'user_url',
313+
],
314+
true
315+
) ) {
316+
$key = $mapping[1];
317+
wp_update_user(
318+
[
319+
'ID' => $user->ID,
320+
$key => $attributes[ $mapping[0] ],
321+
]
322+
);
323+
} else {
324+
update_user_meta( $user->ID, $mapping[1], $attributes[ $mapping[0] ] );
325+
}
324326
}
325327
}
326328
}

inc/class-wp-rainbow.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,10 @@ public function action_init() {
190190
* Get a parsed version of filtered user attributes mapping.
191191
*/
192192
public function get_parsed_user_attributes_mapping() {
193-
$csv = explode( "\n", $this->get_user_attributes_mapping_filtered() );
194-
193+
$csv = array_map( 'trim', explode( "\n", $this->get_user_attributes_mapping_filtered() ) );
195194
return array_map(
196195
function ( $row ) {
197-
return explode( ',', $row );
196+
return array_map( 'trim', explode( ',', $row ) );
198197
},
199198
$csv
200199
);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wp-rainbow",
3-
"version": "0.2.16",
3+
"version": "0.2.17",
44
"description": "RainbowKit Login (Web3 Integration for Sign-In With Ethereum)",
55
"author": "Davis Shaver",
66
"license": "GPL-2.0-or-later",

readme.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Tags: WordPress, web3, SIWE, Ethereum, RainbowKit, Sign-In With Ethereum
44
Tested up to: 6.0
55
Requires at least: 5.9
66
Requires PHP: 7.0
7-
Stable tag: 0.2.16
7+
Stable tag: 0.2.17
88
License: GPLv2 or later
99
License URI: https://www.gnu.org/licenses/gpl-2.0.html
1010

@@ -47,6 +47,9 @@ Find reference implementations of all filters in [example plugin here](https://g
4747

4848
== Changelog ==
4949

50+
= 0.2.17 =
51+
* Fix bug with user_email and user_url fields user meta
52+
5053
= 0.2.16 =
5154
* Add support for mapping ENS text records to user fields
5255

wp-rainbow.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Plugin Name: RainbowKit Login (Web3 Integration for Sign-In With Ethereum)
1111
* Plugin URI: https://wp-rainbow.davisshaver.com/
1212
* Description: RainbowKit Login allows WordPress users to log in with Ethereum using the Sign-In With Ethereum standard, powered by RainbowKit.
13-
* Version: 0.2.16
13+
* Version: 0.2.17
1414
* Author: Davis Shaver
1515
* Author URI: https://davisshaver.com/
1616
* License: GPL v2 or later

0 commit comments

Comments
 (0)