Making WordPress.org

Changeset 4203


Ignore:
Timestamp:
10/08/2016 10:51:26 AM (10 years ago)
Author:
ocean90
Message:

WordPress.org SSO: Use a support email address for email/password change emails.

Location:
sites/trunk/common/includes/wporg-sso
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/common/includes/wporg-sso/class-wporg-sso.php

    r3296 r4203  
    88        class WPOrg_SSO {
    99                const SSO_HOST = 'login.wordpress.org';
     10
     11                const SUPPORT_EMAIL = 'forum-password-resets@wordpress.org';
    1012
    1113                public $sso_host_url;
  • sites/trunk/common/includes/wporg-sso/wp-plugin.php

    r4189 r4203  
    3131
    3232                        if ( $this->has_host() ) {
    33                                 add_action( 'init', array( &$this, 'redirect_all_login_or_signup_to_sso' ) );
     33                                add_action( 'init', array( $this, 'redirect_all_login_or_signup_to_sso' ) );
    3434                                // De-hooking the password change notification, too high volume on wp.org, for no admin value.
    3535                                remove_action( 'after_password_reset', 'wp_password_change_notification' );
    36                         }
     36
     37                                add_filter( 'password_change_email', array( $this, 'replace_admin_email_in_change_emails' ) );
     38                                add_filter( 'email_change_email', array( $this, 'replace_admin_email_in_change_emails' ) );
     39                        }
     40                }
     41
     42                /**
     43                 * Replaces the admin email placeholder with a support email
     44                 * to avoid using the site's admin email.
     45                 *
     46                 * @param array $email The email/password change email.
     47                 * @return array The email/password change email.
     48                 */
     49                public function replace_admin_email_in_change_emails( $email ) {
     50                        $email['headers'] = "From: WordPress.org <donotreply@wordpress.org>\n";
     51                        $email['message'] = str_replace( '###ADMIN_EMAIL###', self::SUPPORT_EMAIL, $email['message'] );
     52                        return $email;
    3753                }
    3854
    3955                /**
    4056                 * Redirect all attempts to get to a WP login or signup to the SSO ones, or to a safe redirect location.
    41 
     57                 *
    4258                 * @example add_action( 'init', array( &$wporg_sso, 'redirect_all_wp_login_or_signup_to_sso' ) );
    4359                 *
Note: See TracChangeset for help on using the changeset viewer.