intercom-wordpress icon indicating copy to clipboard operation
intercom-wordpress copied to clipboard

Incorrect Full Name from integration

Open Frisoni opened this issue 6 years ago • 7 comments

Plugin uses wp_user->display_name to fill user Name in intercom. But, display name can modified and not always is set as "John Doe". Sometimes display_name uses the first part of user email which causes to set name as john_doe_17, for example.

Suggestion is to use wordpress_user->user_firstname." ".wordpress_user->user_lastname instead os display_name.

Frisoni avatar Apr 04 '18 13:04 Frisoni

Whatever the case, result should be filterable to do whatever is needed.

As a matter of fact, the settings output array might already be filterable, so you could override. @Frisoni have you checked?

lkraav avatar Apr 05 '18 02:04 lkraav

Yes, I have know set name correctly with filter, but as an easy to go plugin most customers won't be able to customize using code. I have a lot of incorrect user names in Intercom until I discovered what was going on.

Frisoni avatar Apr 05 '18 12:04 Frisoni

You might have a point - the default should perhaps be not the Display Name.

lkraav avatar Apr 05 '18 18:04 lkraav

@Frisoni Would you mind sharing the filter? @lkraav Any timeline for a fix?

GRSM78 avatar May 03 '18 22:05 GRSM78

It's not really up to me to decide defaults on this project.

lkraav avatar May 04 '18 06:05 lkraav

@GRSM78 This is the filter to use, BUT it doesn`t work every time. :( add_filter( 'intercom_settings', function( $settings ) {
$current_user = wp_get_current_user(); if($current_user->id !== 0){ $settings['name'] = ...; // add specific logic to specify the name } return $settings; } );

Frisoni avatar May 07 '18 02:05 Frisoni

Have you tried to include a priority? Maybe the reason why it's not working every time is that the original filter is being triggered as well (but later), overwriting yours?

GRSM78 avatar May 07 '18 11:05 GRSM78