ultimatemember / Extended

All custom extended features and codes
16 stars 14 forks source link

Ip without dots #92

Open Phobos94 opened 1 month ago

Phobos94 commented 1 month ago

Hello everyone.

Following the installation of the "um-browser-detect" plugin, the IP address is recorded during registration but there is no dots between the numbers. Do you have a solution to resolve this problem?

Thanking you

ip ultimate member

sao321 commented 1 week ago

This is caused by a improper sanitization in Core.php line 98

$field_value = isset( $_SERVER['REMOTE_ADDR'] ) ? wp_unslash( sanitize_key( $_SERVER['REMOTE_ADDR'] ) ) : '';

sanitize_key() is intended for sanitizing keys and slugs, not IP addresses. If we chagne it to sanitize_text_field then it would work without any problem. This is what I did:

$field_value = isset( $_SERVER['REMOTE_ADDR'] ) ? sanitize_text_field( $_SERVER['REMOTE_ADDR'] ) : '';