Changeset 10957
- Timestamp:
- 05/06/2021 06:43:29 AM (4 years ago)
- Location:
- sites/trunk/api.wordpress.org/public_html/dotorg/helpscout
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/api.wordpress.org/public_html/dotorg/helpscout/common.php
r10909 r10957 1 1 <?php 2 2 3 $wp_init_host = 'https://wordpress.org/'; 3 4 $base_dir = dirname( dirname( __DIR__ ) ); 4 5 require( $base_dir . '/wp-init.php' ); … … 25 26 26 27 // get the info from HS 27 return json_decode( $data ); 28 $data = json_decode( $data ); 29 30 // If this is related to a slack user, fetch their details instead. 31 if ( 32 isset ( $data->customer->email, $data->ticket->subject ) && 33 false !== stripos( $data->customer->email, 'slack' ) && 34 preg_match( '/(\S+)@chat.wordpress.org/i', $data->ticket->subject, $m ) 35 ) { 36 $user = get_user_by( 'slug', $m[1] ); 37 if ( $user ) { 38 $data->customer->email = $user->user_email; 39 } 40 } 41 42 return $data; -
sites/trunk/api.wordpress.org/public_html/dotorg/helpscout/dpo.php
r10910 r10957 2 2 // Add current DPO Export/Erasure status for the customer. 3 3 4 $wp_init_host = 'https://wordpress.org/';5 4 // $request is the validated HelpScout request. 6 5 $request = include __DIR__ . '/common.php'; … … 14 13 15 14 // default empty output 16 $html = ''; 17 15 $html = ''; 18 16 $email = $request->customer->email; 19 17 -
sites/trunk/api.wordpress.org/public_html/dotorg/helpscout/profile.php
r10944 r10957 7 7 // default empty output 8 8 $html = ''; 9 $user = false; 9 10 10 11 // Look up a user based on email address … … 62 63 } 63 64 65 // If this is related to a slack user, include the details of the slack account. 66 if ( $user || preg_match( '/(\S+@chat.wordpress.org)/i', $request->ticket->subject, $m ) ) { 67 68 if ( $user ) { 69 $slack_user = $wpdb->get_row( $sql = $wpdb->prepare( 70 'SELECT * FROM slack_users WHERE user_id = %d', 71 $user->ID 72 ) ); 73 } else { 74 $slack_user = $wpdb->get_row( $sql = $wpdb->prepare( 75 'SELECT * FROM slack_users WHERE profiledata LIKE %s', 76 '%' . $wpdb->esc_like( '"email":"' . $m[1] . '"' ) . '%', 77 ) ); 78 } 79 80 if ( $slack_user ) { 81 $slack_data = json_decode( $slack_user->profiledata ); 82 $html .= '<hr/>'; 83 $html .= '<ul>'; 84 $html .= '<li>Slack: <a href="https://wordpress.slack.com/archives/' . $slack_user->dm_id . '">' . esc_html( $slack_data->profile->display_name_normalized ?? $slack_data->profile->display_name ) . '</a></li>'; 85 $html .= '<li>Account ' . ( !empty( $slack_data->deleted ) ? 'Deactivated' : 'Enabled' ) . '</li>'; 86 $html .= '<li>Last Updated: ' . gmdate( 'Y-m-d H:i:s', $slack_data->updated ) . '</li>'; 87 $html .= '</ul>'; 88 } 89 } 90 64 91 // response to HS is just HTML to display in the sidebar 65 92 $response = array( 'html' => $html );
Note: See TracChangeset
for help on using the changeset viewer.