10up / 10up-experience

The 10up Experience plugin configures WordPress to better protect and inform clients, aligned to 10up’s best practices.
GNU General Public License v2.0
129 stars 27 forks source link

Incorrect Role Fallback #134

Closed turtlepod closed 5 months ago

turtlepod commented 1 year ago

https://github.com/10up/10up-experience/blob/a815f9a61d2785cf3ff3d2de3ad586216643458e/includes/classes/SupportMonitor/ActivityLog.php#L137

In this log code, the default is "Subscriber" but in WordPress we can set the default Role. Maybe a better code is:

$role = ( ! empty( $userdata['role'] ) ) ? $userdata['role'] : get_option( 'default_role' );
turtlepod commented 1 year ago

After thinking about it, it actually better to simply use n/a if it's not available. A log need to simply log the actual data.

$role = ( ! empty( $userdata['role'] ) ) ? $userdata['role'] : 'n/a';