Skip to content

Commit

Permalink
Merge pull request #27 from oscarssanchez/fix/issue-25
Browse files Browse the repository at this point in the history
Do not remove user role value from roles property.
  • Loading branch information
Allan Collins authored Aug 30, 2018
2 parents af38cd4 + 50f6767 commit 62dec69
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion classes/class-wp-nr-apm.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ public function set_custom_variables() {
if ( function_exists( 'newrelic_set_user_attributes' ) ) {
if ( is_user_logged_in() ) {
$user = wp_get_current_user();
newrelic_set_user_attributes( $user->ID, '', array_shift( $user->roles ) );
if ( isset( $user->roles[0] ) ) {
newrelic_set_user_attributes( $user->ID, '', $user->roles[0] );
} else {
newrelic_set_user_attributes( $user->ID, '', 'no-role' );
}
} else {
newrelic_set_user_attributes( 'not-logged-in', '', 'no-role' );
}
Expand Down

0 comments on commit 62dec69

Please sign in to comment.