Changeset 7661 for sites/trunk/common/includes/slack/announce/lib.php
- Timestamp:
- 09/12/2018 03:04:38 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/common/includes/slack/announce/lib.php
r5494 r7661 59 59 60 60 function run( $data ) { 61 $user = $data['user_name']; 61 global $wpdb; 62 62 63 $channel = $data['channel_name']; 64 $user = false; 65 66 // Find the user_login for the Slack user_id 67 if ( isset( $data['user_id'] ) ) { 68 $wp_user_id = $wpdb->get_var( $wpdb->prepare( 69 "SELECT user_id FROM slack_users WHERE slack_id = %s", 70 $data['user_id'] 71 ) ); 72 if ( $user = get_user_by( 'id', $wp_user_id ) ) { 73 $user = $user->user_login; 74 } 75 } 76 // Default back to the historical 'user_name' Slack field. 77 if ( ! $user ) { 78 $user = $data['user_name']; 79 } 63 80 64 81 if ( empty( $data['text'] ) ) { … … 114 131 $send->set_icon( call_user_func( $get_avatar, $data['user_name'], $data['user_id'], $data['team_id'] ) ); 115 132 } 116 133 117 134 // By sending the channel ID, we can post to private groups. 118 135 $send->send( $data['channel_id'] );
Note: See TracChangeset
for help on using the changeset viewer.