10up/10up-experience

Incorrect Role Fallback

turtlepod opened this issue · 1 comments

$role = ( ! empty( $userdata['role'] ) ) ? $userdata['role'] : 'Subscriber';

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' );

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';